Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: XML parsing with XML::Rules

by kcott (Archbishop)
on Jun 16, 2013 at 09:17 UTC ( [id://1039188]=note: print w/replies, xml ) Need Help??


in reply to XML parsing with XML::Rules

G'day mcoblentz,

It would appear that's poorly documented and read_chunk_of_data() is either pseudocode or a function you're supposed to write yourself.

I haven't used this module previously; however, something like this seems to be the intent:

$ perl -Mstrict -Mwarnings -e ' use XML::Rules; use Data::Dumper; my @xml = qw{<some_tag> some content </some_tag>}; my $parser = XML::Rules::->new( rules => [ _default => sub {$_[0] => $_[1]->{_content}} ] ); for (@xml) { $parser->parse_chunk($_); } my $data = $parser->last_chunk(); print Dumper $data; ' $VAR1 = { 'some_tag' => 'somecontent' };

Someone who's actually used the module before may have a better answer.

Update: Minor text change: s/write it yourself/write yourself/

-- Ken

Replies are listed 'Best First'.
Re^2: XML parsing with XML::Rules
by Anonymous Monk on Jun 16, 2013 at 09:43 UTC

    or a function you're supposed to write it yourself.

    XML::Rules does show read_chunk_of_data() in documentation for parse_chunk()

      or a function you're supposed to write it yourself.

      XML::Rules does show read_chunk_of_data() in documentation for parse_chunk()

      I've got no idea why you wrote that. There is no suggestion by anyone that it doesn't appear in the documentation. Perhaps you could elaborate on what you meant.

      I have changed "write it yourself" to "write yourself" which is what I originally intended; however, I can't see that either form changes the meaning with respect to what appears in the documentation.

      -- Ken

        I don't remember :) I guess it seems obvious its a function you're supposed to write yourself -- so yeah, what you said is pretty much spot on , except the appear that's poorly documented portion, because that seems like pretty good documentation to me

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-16 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found