PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Methods Available

The Zend_Dom_Query family of classes have the following methods available.

Zend_Dom_Query

The following methods are available to Zend_Dom_Query:

  • setDocumentXml($document): specify an XML string to query against.

  • setDocumentXhtml($document): specify an XHTML string to query against.

  • setDocumentHtml($document): specify an HTML string to query against.

  • setDocument($document): specify a string to query against; Zend_Dom_Query will then attempt to autodetect the document type.

  • getDocument(): retrieve the original document string provided to the object.

  • getDocumentType(): retrieve the document type of the document provided to the object; will be one of the DOC_XML, DOC_XHTML, or DOC_HTML class constants.

  • query($query): query the document using CSS selector notation.

  • queryXpath($xPathQuery): query the document using XPath notation.

Zend_Dom_Query_Result

As mentioned previously, Zend_Dom_Query_Result implements both Iterator and Countable, and as such can be used in a foreach() loop as well as with the count() function. Additionally, it exposes the following methods:

  • getCssQuery(): return the CSS selector query used to produce the result (if any).

  • getXpathQuery(): return the XPath query used to produce the result. Internally, Zend_Dom_Query converts CSS selector queries to XPath, so this value will always be populated.

  • getDocument(): retrieve the DOMDocument the selection was made against.

Zend Framework