Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I use the following code to get the value of email_address and it returns foo.com instead of foo@yahoo.com.<xml> <cat> <email_address><![CDATA[foo@yahoo.com]]></email_address> <name>foo</name> </cat> </xml>
I also tried checking "$arTag->is_cdata" but it returns no value at all. Can you please help? Thanksmy $obj = XML::Twig->new(twig_roots =>{'cat' => \&pp}); $obj->parse($sz); sub pp { my($objXML, $objTag) = @_; $grhshXML = {}; @garTags = (); @garTags = $objTag->children(); foreach my $arTag (@garTags) { $grhshXML->{$arTag->gi()} =$arTag->text(); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: parsing CDATA with XML Twig
by Cody Pendant (Prior) on Nov 26, 2005 at 02:08 UTC |