in reply to Re: Is it possible to parse an XML file recursively using XML::Twig?
in thread Is it possible to parse an XML file recursively using XML::Twig?
I had trouble with your second solution that involved " the '_all_' handler, and test each node for having children". When I ran it, as written, I got output like:
(ArrayOfBooks) Book: (ArrayOfBooks) Book: (Book) Released: (ArrayOfBooks) Book: (ArrayOfBooks) Book: (ArrayOfBooks) Book: Can't call method "tag" on an undefined value at monk_twig_xml_leaf2.p +l line 11. at monk_twig_xml_leaf2.pl line 19. at monk_twig_xml_leaf2.pl line 19.
I tried commenting out the "purge" call and got empty output with no errors, seemingly because $element->has_children was returning true for "#PCDATA" text nodes. I am new to XML:Twig, but not so new to XML, and am starting to appreciate XML::Twig's potential for optimization. I did come up with some working code as well but would first be interested in what I might be doing wrong that Preceptor's example wouldn't run.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Is it possible to parse an XML file recursively using XML::Twig?
by Preceptor (Deacon) on Oct 24, 2015 at 23:23 UTC | |
by mr_ron (Deacon) on Oct 26, 2015 at 14:56 UTC | |
by Ppeoc (Beadle) on Oct 30, 2015 at 18:40 UTC |