I have done a lot of searches on google, but is there a way to parse and get values similar to extracting values from a file, if the XML is contained in the string.
Following is a sample script:
use strict;
use warnings;
use XML::LibXML;
my $xml = "<family><id>25502</id><father><id>1</id></father><mother><id>2</id></mother><son><id>2</id></son></family>";
my $id = $xml->getElementsByTagName("id")->item(0)->getFirstChild->getData;
print $id;
In this example, I could not print the ID. Please help. Thanks.