valavanp has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
i used the following code to get the xml contents from a file. when i use this i am getting only the first para in that file. actually there are 2 paragraphs. Please spot me where i am wrong.
test2.xmluse XML::Twig; my $file = "C:/test2.xml"; my $tmp; $tmp = XML::Twig->new(); $tmp->parsefile($file); my $root = $tmp->root; foreach my $product($root->children('doc')){ my @para=$product->first_child_text('para'); print @para; }
</code><para>aaaaaaaaaaaaaaaaa dsnbbtejk</para> <para>aldmflskddddddddddddddddddffffffffffffff</para>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: reading from xml files
by davorg (Chancellor) on Mar 26, 2007 at 11:33 UTC | |
Re: reading from xml files
by RatKing (Acolyte) on Mar 26, 2007 at 11:51 UTC | |
Re: reading from xml files
by GrandFather (Saint) on Mar 26, 2007 at 22:17 UTC |
Back to
Seekers of Perl Wisdom