Query DOM structures based on CSS selectors and/or XPath

deprecated
see
package Default

 Methods

Constructor

__construct(null|string $document = null, null|string $encoding = null

Parameters

$document

nullstring

$encoding

nullstring

Perform a CSS selector query

execute(string $query) : \Zend\Dom\NodeList

Parameters

$query

string

Returns

\Zend\Dom\NodeList

Retrieve current document

getDocument() : string

Returns

string

Get any DOMDocument errors found

getDocumentErrors() : false | array

Returns

falsearray

Get document type

getDocumentType() : string

Returns

string

Get document encoding

getEncoding() : null | string

Returns

nullstring

Perform an XPath query

queryXpath(string|array $xpathQuery, string|null $query = null) : \Zend\Dom\NodeList

Parameters

$xpathQuery

stringarray

$query

stringnull

CSS selector query

Exceptions

\Zend\Dom\Exception\RuntimeException

Returns

\Zend\Dom\NodeList

Register XPath namespaces

registerXpathNamespaces(array $xpathNamespaces) : void

Parameters

$xpathNamespaces

array

Register PHP Functions to use in internal DOMXPath

registerXpathPhpFunctions(boolean $xpathPhpFunctions = true) : void

Parameters

$xpathPhpFunctions

boolean

Set document to query

setDocument(string $document, null|string $encoding = null) : \Zend\Dom\Query

Parameters

$document

string

$encoding

nullstring

Document encoding

Returns

\Zend\Dom\Query

Register HTML document

setDocumentHtml(string $document, null|string $encoding = null) : \Zend\Dom\Query

Parameters

$document

string

$encoding

nullstring

Document encoding

Returns

\Zend\Dom\Query

Register XHTML document

setDocumentXhtml(string $document, null|string $encoding = null) : \Zend\Dom\Query

Parameters

$document

string

$encoding

nullstring

Document encoding

Returns

\Zend\Dom\Query

Register XML document

setDocumentXml(string $document, null|string $encoding = null) : \Zend\Dom\Query

Parameters

$document

string

$encoding

nullstring

Document encoding

Returns

\Zend\Dom\Query

Set document encoding

setEncoding(string $encoding) : \Zend\Dom\Query

Parameters

$encoding

string

Returns

\Zend\Dom\Query

Prepare node list

getNodeList(\DOMDocument $document, string|array $xpathQuery) : \DOMNodeList

Parameters

$document

\DOMDocument

$xpathQuery

stringarray

Exceptions

\ErrorException If query cannot be executed

Returns

\DOMNodeList

 Properties

 

Document type

$docType : string

Default

 

$document

$document : string

Default

 

DOMDocument errors, if any

$documentErrors : false | array

Default

false
 

Document encoding

$encoding : null | string

Default

 

XPath namespaces

$xpathNamespaces : array

Default

array()
 

XPath PHP Functions

$xpathPhpFunctions : mixed

Default

 Constants

 

DOC_HTML

DOC_HTML = 'docHtml' 
 

DOC_XHTML

DOC_XHTML = 'docXhtml' 
 

DOC_XML

DOC_XML = 'docXml'