in reply to Re: XML::LibXML - How to extract an element including the elements within?
in thread XML::LibXML - How to extract an element including the elements within?
Thanks poj,
This works great for me, and I also realized that I can differentiate the type of node that I get (plain text vs. element):
my ($node) = $dom->findnodes('/doc/text'); my @children = $node->childNodes; foreach my $child (@children) { my $type = ref($child); # $type contains the type of the node, ex: "XML::LibXML::Element" }
From there, I can have a plain text string (no tags) and a separate list of all the elements embedded.
Have a great day!
TA
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: XML::LibXML - How to extract an element including the elements within?
by haukex (Archbishop) on May 10, 2019 at 19:55 UTC | |
by TravelAddict (Acolyte) on May 13, 2019 at 17:33 UTC |