Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: XML Newbie

by runrig (Abbot)
on Nov 16, 2012 at 16:15 UTC ( #1004216=note: print w/ replies, xml ) Need Help??


in reply to XML Newbie

Here's an example w/XML::Rules. Note that getting at the underlying expat parser is undocumented, but I'm sure Jenda would be willing to add something as part of the official API :-)

use strict; use warnings; use XML::Rules; my @rules = ( gibsonca => undef, _default => sub { no warnings 'uninitialized'; return if $_[1]->{_content} =~ /\S/; my $p = $_[4]{parser}; print $p->current_line(),"\n"; return; }, ); my $xr = XML::Rules->new(rules => \@rules); $xr->parse(<<XML); <gibsonca> <abc>fds </abc> <!-- ok --> <ddd></ddd> <!-- not ok --> <eee> </eee> <!-- not ok --> </gibsonca> XML


Comment on Re: XML Newbie
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2015-07-02 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (47 votes), past polls