XmlQuery
in package
XmlQuery
This class represents a query executor for XML documents.
Tags
Table of Contents
Properties
- $_contextNode : XmlNode
- The context node for the query.
- $_operator : DOMXPath
- The XPath operator.
- $_returnAsNamedMap : bool
- Indicates whether to return results as a named map or a simple list.
Methods
- __construct() : mixed
- Constructor.
- Query() : XmlNodeList|XmlNamedNodeList
- Executes the XPath query.
Properties
$_contextNode
The context node for the query.
private
XmlNode
$_contextNode
$_operator
The XPath operator.
private
DOMXPath
$_operator
$_returnAsNamedMap
Indicates whether to return results as a named map or a simple list.
private
bool
$_returnAsNamedMap
Methods
__construct()
Constructor.
public
__construct(XmlNode $node[, bool $returnAsNamedMap = false ][, array<string|int, mixed> $namespaces = [] ]) : mixed
Parameters
- $node : XmlNode
-
The context node.
- $returnAsNamedMap : bool = false
-
Whether to return as a named map.
- $namespaces : array<string|int, mixed> = []
-
Optional array of namespace prefixes and URIs.
Query()
Executes the XPath query.
public
Query(string $xpathQuery) : XmlNodeList|XmlNamedNodeList
Parameters
- $xpathQuery : string
-
The XPath query string.
Return values
XmlNodeList|XmlNamedNodeList —The result node list.