gregor42, thanks.. I guess it seemed obvious to me.. but probably not to anyone else..

First of all, the code is just a modification of the XML::Parser example code.

#!/usr/bin/perl -w use strict; use XML::Parser; # initialize hash that will hold header info my $parser = new XML::Parser(ErrorContext => 4,Handlers => {Start => \ +&handle_start, End => \&handle_end, Char => \&handle_char}); my $counter =0; my @tagdesc; my %tags; # parse the file whose name we specified as a command-line parameter $parser->parsefile(shift); open(OUTPUT, ">tag.desc") or die "No open"; foreach my $keyval(keys %tags) { print OUTPUT $keyval, "\n"; } close OUTPUT; sub handle_start { my $p = shift; my $el = shift; my %attribs = @_; if($el eq 'product_data') { $counter ++; } if($counter) { push(@tagdesc, $el); } } sub handle_char { my ($p, $data) = @_; # print $data,"\n" if $counter; } sub handle_end { my $p = shift; my $el = shift; my %atrribs = @_; my $not_written = 0; if($el eq 'product_data') { $counter --; $not_written = 1;} if($not_written) { my $str = join(':',@tagdesc); @tagdesc = (); if(exists $tags{$str}) { my $cnt = $tags{$str}; $cnt++; $tags{ +$str} = $cnt; } else { $tags{$str} = 1; } $str = undef; $not_written = 0; } }

Unfortunately, the link isn't publically available... and I hope I did an ok job of defining what the weird characters are in the previous post...

finally, thanks for the XML::Parser review.. I did learn from it.. but unfortunately, not enough to solve this problem :o(.. as another question, where can I find XML::UM or anything to do with Unicode and Perl ?
thanks for taking the time out to help a complete newbie.. I do appreciate it..


In reply to Re: Re: XML file won't parse properly by brpsss
in thread XML file won't parse properly by brpsss

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.