I have the following xml code snippet :
<a>
<b> textb <b>
<c> textc <c>
<d> textd <d>
<\a>
<a>
<b> textb <b>
<c> textc <c>
<d> textd <d>
<\a>
I use xml::twig to parse it as below :
my @c= map { $_->text."\n" } $_->findnodes( './a/');
and get the textbtextctextd as one element of the array. Is there an option to get with findnodes
textb,textc,textd as 3 array elements and not one?
Use the star at the end of the expression:
The ‘*‘ matches any tag, so you get the 3 child nodes – your current example only matches the ‘a’, and its text is the concatenation of the text of the nested elements.