I have a simple XML file that looks like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <microplateDoc xmlns="http://moleculardevices.com/microplateML"> <camelids> <species name="Camelus bactrianus"> <common-name>Bactrian Camel</common-name> <physical-characteristics> <mass>450 to 500 kg.</mass> <appearance> Blah blah blah </appearance> </physical-characteristics> </species> </camelids> </microplateDoc>
I am trying to read view names with the following perl script:
use XML::LibXML; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file('/Users/johncumbers/Documents/7_Scripts/Perl/XML_to_MySQL/simplified_camelids.xml'); my $xc = XML::LibXML::XPathContext->new( $doc->documentElement() ); $xc->registerNs('ns', 'http://moleculardevices.com/microplateML');
But I can not find any nodes. Can you help me and explain why it does not work? What is the best website to search for perl functions so that I can try to solve the problem myself? How can I get a script to tell me what it is doing, since the output at the moment is just nothing. Many thanks.
perl xpath libxml2
John
source share