There are many different parsers out there. For straight forward XML tag
extraction I personally like XML::XPath the most. There are some examples in
the pod - try "perldoc XML::XPath".

        use XML::XPath;
        use XML::XPath::XMLParser;

        my $xp = XML::XPath->new(filename => 'test.xhtml');

        my $nodeset = $xp->find('/html/body/p'); # find all paragraphs

        foreach my $node ($nodeset->get_nodelist) {
            print "FOUND\n\n",
                XML::XPath::XMLParser::as_string($node),
                "\n\n";
        }

HTH,
Trevor Joerges
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$_=q;USFWPSZK.ZKPFSHFT,kvtuZbopuifsZQZibdl,qpxfsfeZcyZQ,,iuuq://;.
q;xxx.;.q;~,[EMAIL PROTECTED],;;s;~;tfoenjnf.dpn;g;y;B-x;A-w;;s;P;perl;g;s;,;\n;g;
s;Y; ;g;print;
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message ----- 
From: Vitaly S.
To: [EMAIL PROTECTED]
Sent: Wednesday, April 14, 2004 4:53 AM
Subject: example of XML::Parser


Hi all,

I'm seeking for the example of the XML::Parser module implementation,
or by another words,
how to get the values from the simple XML structure (see example below)
using XML::Parser (can't figure out it from doc-n) ?

<tag1>
<tag2>value1</tag2>
<tag3>value2</tag3>
<tag4>value3</tag4>
</tag1>

Regards.




_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to