Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
XML::TinyXML::SelectorUseraContributed Perl DoXML::TinyXML::Selector::XPath(3)

NAME
       XML::TinyXML::Selector::XPath - XPath-compliant selector	for
       XML::TinyXML

SYNOPSIS
	 use XML::TinyXML;

	 # first obtain	an xml context:
	 $xml =	XML::TinyXML->new("rootnode", param => "somevalue", attrs => { attr1 =>	v1, attr2 => v2	});

	 $selector = XML::TinyXML::Selector->new($xml, "XPath");

	 #####
	 Assuming the following	xml data :
	 <?xml version="1.0"?>
	 <xml>
	   <hello>world</hello>
	   <foo>
	     <![CDATA[ this should unescape <&;	etc... :) ]]>
	   </foo>
	   <parent>
	     <child1/>
	     <child2/>
	     <child3/>
	   </parent>
	   <parent>
	     <blah>SECOND</blah>
	   </parent>
	 </xml>
	 #####

	 @res =	$selector->select('//parent');
	 @res =	$selector->select('//child*');
	 @res =	$selector->select('/parent[2]/blah/..');
	 @res =	$selector->select('//blah/..');
	 @res =	$selector->select('//parent[1]/..');
	 @res =	$selector->select('//parent[1]/.');
	 @res =	$selector->select('//blah/.');

	 # or using the	unabbreviated syntax:

	 @res =	$selector->select('/descendant-or-self::node()/child::parent');
	 @res =	$selector->select('/descendant-or-self::node()/child::child*');
	 @res =	$selector->select('/child::parent[2]/child::blah/parent::node()');
	 @res =	$selector->select('/descendant-or-self::node()/child::blah/parent::node()');
	 @res =	$selector->select('/descendant-or-self::node()/child::parent[1]/parent::node()');
	 @res =	$selector->select('/descendant-or-self::node()/child::parent[1]/self::node()');
	 @res =	$selector->select('/descendant-or-self::node()/child::blah/self::node()');

	 # refer to XPath documentation	for further examples and details on the	supported syntax:
	 # ( http://www.w3.org/TR/xpath	)

DESCRIPTION
       XPath-compliant selector	for XML::TinyXML

INSTANCE VARIABLES
METHODS
       o   init	()

       o   select ($expr, [ $cnode ])

SEE ALSO
	   XML::TinyXML	XML::TinyXML::Node XML::TinyXML::Selector

AUTHOR
       xant, <xant@cpan.org>

COPYRIGHT AND LICENSE
       Copyright (C) 2009-2010 by xant

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself, either Perl	version	5.8.8 or, at
       your option, any	later version of Perl 5	you may	have available.

perl v5.32.0			  2013-09-16  XML::TinyXML::Selector::XPath(3)

NAME | SYNOPSIS | DESCRIPTION | INSTANCE VARIABLES | METHODS | SEE ALSO | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=XML::TinyXML::Selector::XPath&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help