Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: XML::Parser breaks on

by blakem (Monsignor)
on Aug 16, 2001 at 12:14 UTC ( #105304=note: print w/replies, xml ) Need Help??


in reply to XML::Parser breaks on

I think you'll have to glue it all together. Here is a snippet that might help a bit.

sub xml_char { my ($xp, $txt) = @_; my $el = $xp->current_element(); $val{$el} .= $txt if $txt =~ /\S/; }

Notice that %val is sort of a buffer area that will need to be cleaned up when you hit the end tag.

-Blake

Replies are listed 'Best First'.
Re: Re: XML::Parser breaks on
by clintp (Curate) on Aug 16, 2001 at 17:31 UTC
    I've used something like this before, and like the general technique, but I question:
    $val{$el}.=$txt if $txt =~ /\S/;
    Since the parser is actually allowed to break anywhere you could lose intra-word spaces or newlines (if they're signicficant).
      You're probably right and its a piece of code I haven't looked at in a long time. I do remember there being a reson for it, but can't remember it right now. Anyone looking at using this, should probably get rid of the if conditional.

      -Blake

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://105304]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (None)
    As of 2021-10-19 05:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My first memorable Perl project was:







      Results (76 votes). Check out past polls.

      Notices?