didou           Sun Dec 19 08:21:33 2004 EDT

  Added files:                 
    /phpdoc/en/reference/dom/functions  dom-domxpath-construct.xml 

  Modified files:              
    /phpdoc/entities    global.ent 
    /phpdoc/en/reference/dom    reference.xml 
    /phpdoc/en/reference/dom/functions  
                                        dom-domimplementation-hasfeature.xml 
                                        dom-domxpath-query.xml 
  Log:
  Added a generic XML file for use in examples
  Added DOMImplementation and documented DOMImplemntation::hasFeature()
  Added DOMXPath::__construct and documented DOMXPath::query
  
http://cvs.php.net/diff.php/phpdoc/entities/global.ent?r1=1.207&r2=1.208&ty=u
Index: phpdoc/entities/global.ent
diff -u phpdoc/entities/global.ent:1.207 phpdoc/entities/global.ent:1.208
--- phpdoc/entities/global.ent:1.207    Fri Dec 17 11:15:36 2004
+++ phpdoc/entities/global.ent  Sun Dec 19 08:21:29 2004
@@ -1,6 +1,6 @@
 <!-- -*- SGML -*-
 
- $Id: global.ent,v 1.207 2004/12/17 16:15:36 didou Exp $
+ $Id: global.ent,v 1.208 2004/12/19 13:21:29 didou Exp $
 
  Contains global "macros" for all the XML documents.
 
@@ -61,6 +61,7 @@
 <!ENTITY url.docbook-dtdref "http://www.docbook.org/tdg/en/html/part2.html";>
 <!ENTITY url.docbook-intro 
"http://nis-www.lanl.gov/~rosalia/mydocs/docbook-intro.html";>
 <!ENTITY url.dom2.spec "http://www.w3c.org/DOM/DOMTR#dom2";>
+<!ENTITY url.dom2.features 
"http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/introduction.html#ID-Conformance";>
 <!ENTITY url.domxml "http://www.xmlsoft.org/";>
 <!ENTITY url.dsssl "http://www.jclark.com/dsssl/";>
 <!ENTITY url.echo-print 
"http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40";>
http://cvs.php.net/diff.php/phpdoc/en/reference/dom/reference.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/reference/dom/reference.xml
diff -u phpdoc/en/reference/dom/reference.xml:1.5 
phpdoc/en/reference/dom/reference.xml:1.6
--- phpdoc/en/reference/dom/reference.xml:1.5   Fri Dec 17 12:51:20 2004
+++ phpdoc/en/reference/dom/reference.xml       Sun Dec 19 08:21:32 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
  <reference id="ref.dom">
   <title>DOM Functions</title>
   <titleabbrev>DOM</titleabbrev>
@@ -648,6 +648,30 @@
      </section>
     </section>
 
+    <section id='dom.class.domimplementation'>
+     <title><classname>DOMImplementation</classname></title>
+     <para>
+      The <classname>DOMImplementation</classname> interface provides a number
+      of methods for performing operations that are independent of any 
+      particular instance of the document object model.
+     </para>
+     <section id='dom.class.domimplementation.methods'>
+      &reftitle.methods;
+      <itemizedlist>
+       <listitem>
+        <para><link 
linkend='function.dom-domimplementation-createdocument'>createDocument</link> - 
Creates a DOM Document object of the specified type with its document 
element</para>
+       </listitem>
+       <listitem>
+        <para><link 
linkend='function.dom-domimplementation-createdocumenttype'>createDocumentType</link>
 - Creates an empty DOMDocumentType object</para>
+       </listitem>
+       <listitem>
+        <para><link 
linkend='function.dom-domimplementation-hasfeature'>hasFeature</link> - Test if 
the DOM implementation implements a specific feature</para>
+       </listitem>
+      </itemizedlist>
+     </section>
+    </section>
+
+    
     <section id='dom.class.domnamelist'>
      <title><classname>DOMNameList</classname></title>
      <para>
@@ -1019,6 +1043,14 @@
      <title><classname>DOMXPath</classname></title>
      <para>
      </para>
+     <section id='dom.class.domxpath.constructor'>
+      &reftitle.constructor;
+      <itemizedlist>
+       <listitem>
+        <para><link 
linkend='function.dom-domxpath-construct'>__construct</link> - construct a new 
DOMXPath object</para>
+       </listitem>
+      </itemizedlist>
+     </section>
      <section id='dom.class.domxpath.methods'>
       &reftitle.methods;
       <itemizedlist>
@@ -1061,6 +1093,55 @@
     
    </section>
    
+   <section id="dom.examples">
+    &reftitle.examples;
+    <para>
+     Many examples in this reference require an XML file. We will use the 
+     <filename>chapter.xml</filename> that contains the following:
+    </para>
+    <para>
+     <example>
+      <title>chapter.xml</title>
+      <programlisting role="xml">
+<![CDATA[
+<?xml version="1.0" standalone="yes"?>
+<!DOCTYPE chapter PUBLIC '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd'
+[ <!ENTITY sp "spanish">
+]>
+<chapter language="en">
+ <title language="en">Title</title>
+ <para language="ge">
+  &amp;sp;
+  <!-- comment -->
+  <informaltable ID="findme" language="&amp;sp;">
+   <tgroup cols="3">
+    <tbody>
+     <row>
+      <entry>a1</entry>
+      <entry morerows="1">b1</entry>
+      <entry>c1</entry>
+     </row>
+     <row>
+      <entry>a2</entry>
+      <entry>c2</entry>
+     </row>
+     <row>
+      <entry>a3</entry>
+      <entry>b3</entry>
+      <entry>c3</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </informaltable>
+ </para>
+</chapter>
+]]>
+      </programlisting>
+     </example>
+    </para>
+   </section>
+   
+   
   &reference.dom.constants;
    
   </partintro>
http://cvs.php.net/diff.php/phpdoc/en/reference/dom/functions/dom-domimplementation-hasfeature.xml?r1=1.4&r2=1.5&ty=u
Index: phpdoc/en/reference/dom/functions/dom-domimplementation-hasfeature.xml
diff -u 
phpdoc/en/reference/dom/functions/dom-domimplementation-hasfeature.xml:1.4 
phpdoc/en/reference/dom/functions/dom-domimplementation-hasfeature.xml:1.5
--- phpdoc/en/reference/dom/functions/dom-domimplementation-hasfeature.xml:1.4  
Fri Dec 17 10:11:30 2004
+++ phpdoc/en/reference/dom/functions/dom-domimplementation-hasfeature.xml      
Sun Dec 19 08:21:33 2004
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
   <refentry id='function.dom-domimplementation-hasfeature'>
    <refnamediv>
     <refname>DOMImplementation->hasFeature</refname>
     <refpurpose>
-     Test if the DOM implementation implements a specific feature and version
+     Test if the DOM implementation implements a specific feature
     </refpurpose>
    </refnamediv>
    <refsect1>
@@ -19,8 +19,54 @@
      </methodsynopsis>
     </classsynopsis>
     <para>
-     Test if the DOM implementation implements a specific feature and version.
+     Test if the DOM implementation implements a specific 
+     <parameter>feature</parameter>. &return.success;
     </para>
+    <para>
+     You can find a list of all features in the <ulink
+     url="&url.dom2.features;">Conformance</ulink> section of the DOM
+     specification.
+    </para>
+    <para>
+     <parameter>version</parameter> is the version number of the feature to
+     test. In level 2, this can be either <literal>2.0</literal> or
+     <literal>1.0</literal>.
+    </para>
+    <example>
+     <title>Testing your DOM Implementation</title>
+     <programlisting role="php">
+<![CDATA[
+<?php
+
+$features = array(
+  'Core'           => '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";
+  }
+}
+
+?>
+]]>
+     </programlisting>
+    </example>
    </refsect1>
   </refentry>
 
http://cvs.php.net/diff.php/phpdoc/en/reference/dom/functions/dom-domxpath-query.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/reference/dom/functions/dom-domxpath-query.xml
diff -u phpdoc/en/reference/dom/functions/dom-domxpath-query.xml:1.5 
phpdoc/en/reference/dom/functions/dom-domxpath-query.xml:1.6
--- phpdoc/en/reference/dom/functions/dom-domxpath-query.xml:1.5        Fri Dec 
17 11:15:37 2004
+++ phpdoc/en/reference/dom/functions/dom-domxpath-query.xml    Sun Dec 19 
08:21:33 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
   <refentry id="function.dom-domxpath-query">
    <refnamediv>
     <refname>DOMXPath->query</refname>
@@ -19,16 +19,76 @@
      </methodsynopsis>
     </classsynopsis>
     <para>
-     Returns a DOMNodeList containing all nodes matching 
-     <parameter>expression</parameter>. Any expression which do not return 
-     nodes will return an empty DOMNodeList.
+     Returns a <classname>DOMNodeList</classname> containing all nodes 
matching 
+     the given XPath <parameter>expression</parameter>. Any expression which do
+     not return nodes will return an empty <classname>DOMNodeList</classname>.
+    </para>
+    <para>
+     <example>
+      <title>Getting all entries begining with "b"</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+
+$doc = new DOMDocument;
+$doc->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";
+}
+?>
+]]>
+      </programlisting>
+      &example.outputs;
+      <screen>
+<![CDATA[
+cell: b1
+cell: b3
+]]>
+      </screen>
+     </example>
     </para>
     <para>
      The optional <parameter>contextnode</parameter> 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:
     </para>
-   </refsect1>
-  </refentry>
+    <para>
+     <example>
+      <title>Using the context node</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+
+$doc = new DOMDocument;
+$doc->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";
+}
+?>
+]]>
+     </programlisting>
+    </example>
+   </para>
+  </refsect1>
+ </refentry>
 
 <!-- Keep this comment at the end of the file
 Local variables:

http://cvs.php.net/co.php/phpdoc/en/reference/dom/functions/dom-domxpath-construct.xml?r=1.1&p=1
Index: phpdoc/en/reference/dom/functions/dom-domxpath-construct.xml
+++ phpdoc/en/reference/dom/functions/dom-domxpath-construct.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
  <refentry id='function.dom-domxpath-construct'>
   <refnamediv>
    <refname>DOMXPath->__construct</refname>
    <refpurpose>
     Creates a new DOMXPath object
    </refpurpose>
   </refnamediv>
   <refsect1>
    &reftitle.description;
    <classsynopsis>
    <ooclass><classname>DOMXPath</classname></ooclass>
     <constructorsynopsis>
      <methodname>__construct</methodname>
      
<methodparam><type>DOMDocument</type><parameter>doc</parameter></methodparam>
     </constructorsynopsis> 
    </classsynopsis>
    <para>
     Creates a new <classname>DOMXPath</classname> object.
    </para>
   </refsect1>
  </refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

Reply via email to