use XML::XPath;
my $xp = XML::XPath->new(filename => 'greet.xml');
print $xp->findvalue('//greeting/text()')->value();
####
use XML::LibXML;
my $parser = XML::LibXML->new();
my $doc = $parser->parse_string(<<'EOT');
EOT
foreach my $node ($doc->findnodes('//Paths/*') )
{
print $node->nodeName(), ($node->attributes())[0]->nodeValue(),"\n";
}
##
##
C:\Documents and Settings\jstowe-admin>install http://theoryx5.uwinnipeg.ca/ppms
/XML-LibXML.ppd
'install' is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\jstowe-admin>ppm install http://theoryx5.uwinnipeg.ca/
ppms/XML-LibXML.ppd
====================
Install 'XML-NamespaceSupport' version 1.09 in ActivePerl 5.8.7.815.
====================
Installing C:\Perl\html\site\lib\XML\NamespaceSupport.html
Installing C:\Perl\site\lib\XML\NamespaceSupport.pm
Successfully installed XML-NamespaceSupport version 1.09 in ActivePerl 5.8.7.815
.
====================
Install 'XML-SAX' version 0.14 in ActivePerl 5.8.7.815.
====================
Installing C:\Perl\html\site\lib\XML\SAX.html
Installing C:\Perl\html\site\lib\XML\SAX\Base.html
Installing C:\Perl\html\site\lib\XML\SAX\DocumentLocator.html
Installing C:\Perl\html\site\lib\XML\SAX\Exception.html
Installing C:\Perl\html\site\lib\XML\SAX\Intro.html
Installing C:\Perl\html\site\lib\XML\SAX\ParserFactory.html
Installing C:\Perl\html\site\lib\XML\SAX\PurePerl.html
Installing C:\Perl\html\site\lib\XML\SAX\PurePerl\Reader.html
Installing C:\Perl\site\lib\XML\SAX.pm
Installing C:\Perl\site\lib\XML\SAX\Base.pm
Installing C:\Perl\site\lib\XML\SAX\DocumentLocator.pm
Installing C:\Perl\site\lib\XML\SAX\Exception.pm
Installing C:\Perl\site\lib\XML\SAX\Intro.pod
Installing C:\Perl\site\lib\XML\SAX\ParserFactory.pm
Installing C:\Perl\site\lib\XML\SAX\placeholder.pl
Installing C:\Perl\site\lib\XML\SAX\PurePerl.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\DebugHandler.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\DocType.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\DTDDecls.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\EncodingDetect.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\Exception.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\NoUnicodeExt.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\Productions.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\Reader.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\UnicodeExt.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\XMLDecl.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\Reader\NoUnicodeExt.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\Reader\Stream.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\Reader\String.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\Reader\UnicodeExt.pm
Installing C:\Perl\site\lib\XML\SAX\PurePerl\Reader\URI.pm
Successfully installed XML-SAX version 0.14 in ActivePerl 5.8.7.815.
could not find ParserDetails.ini in C:/Perl/site/lib/XML/SAX
Unable to recognise encoding of this document at C:/Perl/site/lib/XML/SAX/PurePe
rl/EncodingDetect.pm line 96, <$__ANONIO__> line 70.
Unable to recognise encoding of this document at C:/Perl/site/lib/XML/SAX/PurePe
rl/EncodingDetect.pm line 96, <$__ANONIO__> line 79.
====================
Install 'XML-NamespaceSupport' version 1.09 in ActivePerl 5.8.7.815.
====================
could not find ParserDetails.ini in C:/Perl/site/lib/XML/SAX
Unable to recognise encoding of this document at C:/Perl/site/lib/XML/SAX/PurePe
rl/EncodingDetect.pm line 96, line 85.
Successfully installed XML-NamespaceSupport version 1.09 in ActivePerl 5.8.7.815
.
====================
Install 'XML-LibXML-Common' version 0.13 in ActivePerl 5.8.7.815.
====================
Installing C:\Perl\site\lib\auto\XML\LibXML\Common\Common.bs
Installing C:\Perl\site\lib\auto\XML\LibXML\Common\Common.dll
Installing C:\Perl\site\lib\auto\XML\LibXML\Common\Common.exp
Installing C:\Perl\site\lib\auto\XML\LibXML\Common\Common.lib
Installing C:\Perl\html\site\lib\XML\LibXML\Common.html
Files found in blib\arch: installing files in blib\lib into architecture depende
nt library tree
Installing C:\Perl\site\lib\XML\LibXML\Common.pm
The library libxml2.dll is needed to complete the installation,
and should be placed in a directory somewhere in your PATH
environment variable. I can fetch and install this for you,
if you don't already have it.
Fetch libxml2.dll? [yes] yes
Fetching http://theoryx5.uwinnipeg.ca/ppms/scripts/libxml2.dll ... done!
Where should libxml2.dll be placed? [C:\Perl\bin]
libxml2.dll has been successfully installed to C:/Perl/bin
Successfully installed XML-LibXML-Common version 0.13 in ActivePerl 5.8.7.815.
====================
Install 'XML-LibXML' version 1.58 in ActivePerl 5.8.7.815.
====================
Installing C:\Perl\site\lib\auto\XML\LibXML\LibXML.bs
Installing C:\Perl\site\lib\auto\XML\LibXML\LibXML.dll
Installing C:\Perl\site\lib\auto\XML\LibXML\LibXML.exp
Installing C:\Perl\site\lib\auto\XML\LibXML\LibXML.lib
Installing C:\Perl\html\site\lib\XML\LibXML.html
Installing C:\Perl\html\site\lib\XML\LibXML\Attr.html
Installing C:\Perl\html\site\lib\XML\LibXML\Boolean.html
Installing C:\Perl\html\site\lib\XML\LibXML\CDATASection.html
Installing C:\Perl\html\site\lib\XML\LibXML\Comment.html
Installing C:\Perl\html\site\lib\XML\LibXML\Document.html
Installing C:\Perl\html\site\lib\XML\LibXML\DocumentFragment.html
Installing C:\Perl\html\site\lib\XML\LibXML\DOM.html
Installing C:\Perl\html\site\lib\XML\LibXML\Dtd.html
Installing C:\Perl\html\site\lib\XML\LibXML\Element.html
Installing C:\Perl\html\site\lib\XML\LibXML\Literal.html
Installing C:\Perl\html\site\lib\XML\LibXML\Namespace.html
Installing C:\Perl\html\site\lib\XML\LibXML\Node.html
Installing C:\Perl\html\site\lib\XML\LibXML\NodeList.html
Installing C:\Perl\html\site\lib\XML\LibXML\Number.html
Installing C:\Perl\html\site\lib\XML\LibXML\Parser.html
Installing C:\Perl\html\site\lib\XML\LibXML\PI.html
Installing C:\Perl\html\site\lib\XML\LibXML\SAX.html
Installing C:\Perl\html\site\lib\XML\LibXML\Text.html
Installing C:\Perl\html\site\lib\XML\LibXML\SAX\Builder.html
Installing C:\Perl\html\site\lib\XML\LibXML\SAX\Generator.html
Files found in blib\arch: installing files in blib\lib into architecture depende
nt library tree
Installing C:\Perl\site\lib\XML\LibXML.pm
Installing C:\Perl\site\lib\XML\LibXML.pod
Installing C:\Perl\site\lib\XML\LibXML\Attr.pod
Installing C:\Perl\site\lib\XML\LibXML\Boolean.pm
Installing C:\Perl\site\lib\XML\LibXML\CDATASection.pod
Installing C:\Perl\site\lib\XML\LibXML\Comment.pod
Installing C:\Perl\site\lib\XML\LibXML\Document.pod
Installing C:\Perl\site\lib\XML\LibXML\DocumentFragment.pod
Installing C:\Perl\site\lib\XML\LibXML\DOM.pod
Installing C:\Perl\site\lib\XML\LibXML\Dtd.pod
Installing C:\Perl\site\lib\XML\LibXML\Element.pod
Installing C:\Perl\site\lib\XML\LibXML\Literal.pm
Installing C:\Perl\site\lib\XML\LibXML\Namespace.pod
Installing C:\Perl\site\lib\XML\LibXML\Node.pod
Installing C:\Perl\site\lib\XML\LibXML\NodeList.pm
Installing C:\Perl\site\lib\XML\LibXML\Number.pm
Installing C:\Perl\site\lib\XML\LibXML\Parser.pod
Installing C:\Perl\site\lib\XML\LibXML\PI.pod
Installing C:\Perl\site\lib\XML\LibXML\SAX.pm
Installing C:\Perl\site\lib\XML\LibXML\SAX.pod
Installing C:\Perl\site\lib\XML\LibXML\Text.pod
Installing C:\Perl\site\lib\XML\LibXML\SAX\Builder.pm
Installing C:\Perl\site\lib\XML\LibXML\SAX\Builder.pod
Installing C:\Perl\site\lib\XML\LibXML\SAX\Generator.pm
Installing C:\Perl\site\lib\XML\LibXML\SAX\Parser.pm
Successfully installed XML-LibXML version 1.58 in ActivePerl 5.8.7.815.
C:\Documents and Settings\jstowe-admin>