diff --git a/reference/dom/functions/dom-domimplementation-hasfeature.xml b/reference/dom/functions/dom-domimplementation-hasfeature.xml index 777cb4cc59..6d656d85b5 100644 --- a/reference/dom/functions/dom-domimplementation-hasfeature.xml +++ b/reference/dom/functions/dom-domimplementation-hasfeature.xml @@ -1,10 +1,10 @@ - + DOMImplementation->hasFeature - Test if the DOM implementation implements a specific feature and version + Test if the DOM implementation implements a specific feature @@ -19,8 +19,54 @@ - Test if the DOM implementation implements a specific feature and version. + Test if the DOM implementation implements a specific + feature. &return.success; + + You can find a list of all features in the Conformance section of the DOM + specification. + + + version is the version number of the feature to + test. In level 2, this can be either 2.0 or + 1.0. + + + Testing your DOM Implementation + + 'Core module', + 'XML' => 'XML module', + 'HTML' => 'HTML module', + 'Views' => 'Views module', + 'Stylesheets' => 'Style Sheets module', + 'CSS' => 'CSS module', + 'CSS2' => 'CSS2 module', + 'Events' => 'Events module', + 'UIEvents' => 'User interface Events module', + 'MouseEvents' => 'Mouse Events module', + 'MutationEvents' => 'Mutation Events module', + 'HTMLEvents' => 'HTML Events module', + 'Range' => 'Range module', + 'Traversal' => 'Traversal module' +); + +foreach ($features as $key => $name) { + if (DOMImplementation::hasFeature($key, '2.0')) { + echo "Has feature $name\n"; + } else { + echo "Missing feature $name\n"; + } +} + +?> +]]> + + diff --git a/reference/dom/functions/dom-domxpath-construct.xml b/reference/dom/functions/dom-domxpath-construct.xml new file mode 100644 index 0000000000..84f392235b --- /dev/null +++ b/reference/dom/functions/dom-domxpath-construct.xml @@ -0,0 +1,44 @@ + + + + + DOMXPath->__construct + + Creates a new DOMXPath object + + + + &reftitle.description; + + DOMXPath + + __construct + DOMDocumentdoc + + + + Creates a new DOMXPath object. + + + + + diff --git a/reference/dom/functions/dom-domxpath-query.xml b/reference/dom/functions/dom-domxpath-query.xml index 9bc11e6610..6afde732f1 100644 --- a/reference/dom/functions/dom-domxpath-query.xml +++ b/reference/dom/functions/dom-domxpath-query.xml @@ -1,5 +1,5 @@ - + DOMXPath->query @@ -19,16 +19,76 @@ - Returns a DOMNodeList containing all nodes matching - expression. Any expression which do not return - nodes will return an empty DOMNodeList. + Returns a DOMNodeList containing all nodes matching + the given XPath expression. Any expression which do + not return nodes will return an empty DOMNodeList. + + + + Getting all entries begining with "b" + +Load('chapter.xml'); + +$xpath = new DOMXPath($doc); + +// We starts from the root element +$query = '//chapter/para/informaltable/tgroup/tbody/row/entry[substring(., 1, 1) = "b"]'; + +$entries = $xpath->query($query); + +foreach ($entries as $entry) { + echo 'cell: ' . $entry->nodeValue . "\n"; +} +?> +]]> + + &example.outputs; + + + + The optional contextnode can be specified for doing - relative XPath queries. + relative XPath queries. By default, the queries are relative to the root + element. Knowing that, we can rewrite our previous example as follow: - - + + + Using the context node + +Load('chapter.xml'); + +$xpath = new DOMXPath($doc); + +$tbody = $doc->getElementsByTagName('tbody')->item(0); + +// our query is relative to the tbody node +$query = 'row/entry[substring(., 1, 1) = "b"]'; + +$entries = $xpath->query($query, $tbody); + +foreach ($entries as $entry) { + echo 'cell: ' . $entry->nodeValue . "\n"; +} +?> +]]> + + + + + + DOM Functions DOM @@ -648,6 +648,30 @@ +
+ <classname>DOMImplementation</classname> + + The DOMImplementation interface provides a number + of methods for performing operations that are independent of any + particular instance of the document object model. + +
+ &reftitle.methods; + + + createDocument - Creates a DOM Document object of the specified type with its document element + + + createDocumentType - Creates an empty DOMDocumentType object + + + hasFeature - Test if the DOM implementation implements a specific feature + + +
+
+ +
<classname>DOMNameList</classname> @@ -1019,6 +1043,14 @@ <classname>DOMXPath</classname> +
+ &reftitle.constructor; + + + __construct - construct a new DOMXPath object + + +
&reftitle.methods; @@ -1061,6 +1093,55 @@
+
+ &reftitle.examples; + + Many examples in this reference require an XML file. We will use the + chapter.xml that contains the following: + + + + chapter.xml + + + +]> + + Title + + &sp; + + + + + + a1 + b1 + c1 + + + a2 + c2 + + + a3 + b3 + c3 + + + + + + +]]> + + + +
+ + &reference.dom.constants;