http://qs321.pair.com?node_id=1218899


in reply to Re^2: get text from node - XML::LibXML
in thread get text from node - XML::LibXML

What is your full code? What output do you get? What do you expect?

Unless you tell us that, we can't figure out where you're going wrong.

Here's the code for an example I created:

use strict; my $str = q{<seg><foo mid="0" mtype="seg"><g id="1">Need to export thi +s text</g></foo></seg>}; my $xml = XML::LibXML->load_xml(string => $str); print $xml->getElementsByTagName("g")->shift->toString, "\n";

The output is:

<g id="1">Need to export this text</g>

Which is exactly what I'd expect it to be.

What is your full code? What output do you get? What do you expect?