I am a test application
VM ISV branding information Myprodoct-11.10 Some Company 11.10.0.24 11.10.0.24 http://www.hp.com Application
4c555gh-67yh-49987c-a7ed-21345yght94b another product UUID shubhra 71ab92ef-b47e-47ea-8e5a-0d76b70aacc4 333334444444444I-am-khan-product-RID
#### #!/usr/bin/perl use strict ; use warnings ; use XML::LibXML ; use XML::LibXML::XPathContext; #use File::Slurp; my $parser = XML::LibXML->new() ; my $doc ; my $nameSpaces = {} ; my $resultHash = {} ; my @nodes; my $node; my $owner; my $xpaths = { #queryOne => '//info/app/name', #queryTwo => '//info/app/owner', #queryThree => '//info/app/description', queryFour =>'//ovf:Envelope/Section/Annotation', queryFive =>'//Section/Product', querysix =>'//vadk:ProductRID', queryseven => '//ovf:Envelope/Section/vadk:ProductRID', queryeight => '//ovf:Envelope/Section/vadk:ProductRID', } ; eval{ $doc = $parser->parse_file( '/root/shubhra/myapp/profile.xml' ) ; }; if( $@ ){ print "Parsing error $@" ; } my $xc = XML::LibXML::XPathContext->new( $doc->documentElement() ) ; # I put them into a hash to remove duplicates - probably un-nessasary foreach my $node ( $doc->findnodes( '//*/namespace::*' ) ) { $nameSpaces->{ $node->getLocalName() } = $node->getValue() ; #print "\n local name :",$node->getLocalName(),"\n"; #print "\n node value :",$node->getValue(),"\n"; } for my $ns ( keys %{ $nameSpaces } ){ $xc->registerNs( $ns => $nameSpaces->{ $ns } ) ; print "\n $ns"; print "\n $nameSpaces->{ $ns }"; } my $result="London university"; print "\n Query results :\n \n"; foreach my $query ( keys %$xpaths ){ print "\n Inside Loop"; foreach my $node ($xc->findnodes( $xpaths->{ $query } )) { print "\n INNER LOOP"; $node->appendText("hello world"); print $node->textContent,"\n"; } } $xc->to_String; #not working