php-doc-en/functions/domxml.xml
Uwe Steinmann 93a7143908 - fixed syntax errors
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@40449 c90b9560-bf6c-de11-be94-00142212c4b1
2001-01-31 16:37:26 +00:00

696 lines
17 KiB
XML

<reference id="ref.domxml">
<title>DOM XML functions</title>
<titleabbrev>DOM XML</titleabbrev>
<partintro>
<simpara>
This documentation ist not finished yet. Don't start to translate it
or use it as a programming reference (steinm@php.net).
</simpara>
<simpara>
These functions are only available if PHP was configured with
<option role="configure">--with-dom=[DIR]</option>, using the
GNOME xml library. You will need at least libxml-2.2.7
These functions have been added in PHP 4.
</simpara>
<simpara>
The extension allows to operate on an XML document with the DOM api.
It also provides a function <function>xmltree</function> to turn the
complete XML document into a tree of php objects. Currently this
tree is read only, which doesn't mean you cannot modify it, but it
would make any sense since <function>dumpmem</function> cannot be
applied to it. Therefore, if you want to read an XML file and write
a modified version use the <function>add_node</function>,
<function>set_attribute</function>, etc. and finaly
<function>dumpmem</function> functions.
</simpara>
<simpara>
This module defines the following constants:
</simpara>
<table>
<title>XML constants</title>
<tgroup cols="3">
<thead>
<row>
<entry>Constant</entry>
<entry>Value</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>XML_ELEMENT_NODE</entry>
<entry>1</entry>
<entry>Node is an element</entry>
</row>
<row>
<entry>XML_ATTRIBUTE_NODE</entry>
<entry>2</entry>
<entry>Node is an attribute</entry>
</row>
<row>
<entry>XML_TEXT_NODE</entry>
<entry>3</entry>
<entry>Node is a piece of text</entry>
</row>
<row>
<entry>XML_CDATA_SECTION_NODE</entry>
<entry>4</entry>
<entry></entry>
</row>
<row>
<entry>XML_ENTITY_REF_NODE</entry>
<entry>5</entry>
<entry></entry>
</row>
<row>
<entry>XML_ENTITY_NODE</entry>
<entry>6</entry>
<entry>Node is an entity like &amp;nbsp;</entry>
</row>
<row>
<entry>XML_PI_NODE</entry>
<entry>7</entry>
<entry>Node is a processing instruction</entry>
</row>
<row>
<entry>XML_COMMENT_NODE</entry>
<entry>8</entry>
<entry>Node is a comment</entry>
</row>
<row>
<entry>XML_DOCUMENT_NODE</entry>
<entry>9</entry>
<entry>Node is a document</entry>
</row>
<row>
<entry>XML_DOCUMENT_TYPE_NODE</entry>
<entry>10</entry>
<entry></entry>
</row>
<row>
<entry>XML_DOCUMENT_FRAG_NODE</entry>
<entry>11</entry>
<entry></entry>
</row>
<row>
<entry>XML_NOTATION_NODE</entry>
<entry>12</entry>
<entry></entry>
</row>
<row>
<entry>XML_GLOBAL_NAMESPACE</entry>
<entry>1</entry>
<entry></entry>
</row>
<row>
<entry>XML_LOCAL_NAMESPACE</entry>
<entry>2</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
<simpara>
This module defines a number of classes, which are listed &mdash;
including their
properties and method &mdash; in the following table.
</simpara>
<para>
<table>
<title>DomDocument class (methods)</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>PHP name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>root</entry>
<entry>domxml_root</entry>
<entry></entry>
</row>
<row>
<entry>children</entry>
<entry>domxml_children</entry>
<entry></entry>
</row>
<row>
<entry>add_root</entry>
<entry>domxml_add_root</entry>
<entry></entry>
</row>
<row>
<entry>dtd</entry>
<entry>domxml_intdtd</entry>
<entry></entry>
</row>
<row>
<entry>dumpmem</entry>
<entry>domxml</entry>
<entry></entry>
</row>
<row>
<entry>xpath_init</entry>
<entry>xpath_init</entry>
<entry></entry>
</row>
<row>
<entry>xpath_new_context</entry>
<entry>xpath_new_context</entry>
<entry></entry>
</row>
<row>
<entry>xptr_new_context</entry>
<entry>xptr_new_context</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table>
<title>DomDocument class (attributes)</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>doc</entry>
<entry>class DomDocument</entry>
<entry>The object itself</entry>
</row>
<row>
<entry>name</entry>
<entry>string</entry>
<entry></entry>
</row>
<row>
<entry>url</entry>
<entry>string</entry>
<entry></entry>
</row>
<row>
<entry>version</entry>
<entry></entry>
<entry>string</entry>
</row>
<row>
<entry>encoding</entry>
<entry>string</entry>
<entry></entry>
</row>
<row>
<entry>standalone</entry>
<entry>long</entry>
<entry></entry>
</row>
<row>
<entry>type</entry>
<entry>long</entry>
<entry></entry>
</row>
<row>
<entry>compression</entry>
<entry>long</entry>
<entry></entry>
</row>
<row>
<entry>charset</entry>
<entry>long</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table>
<title>DomNode class (methods)</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>PHP name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>lastchild</entry>
<entry>domxml_last_child</entry>
<entry></entry>
</row>
<row>
<entry>children</entry>
<entry>domxml_children</entry>
<entry></entry>
</row>
<row>
<entry>parent</entry>
<entry>domxml_parent</entry>
<entry></entry>
</row>
<row>
<entry>new_child</entry>
<entry>domxml_new_child</entry>
<entry></entry>
</row>
<row>
<entry>get_attribute</entry>
<entry>domxml_get_attribute</entry>
<entry></entry>
</row>
<row>
<entry>set_attribute</entry>
<entry>domxml_set_attribute</entry>
<entry></entry>
</row>
<row>
<entry>attributes</entry>
<entry>domxml_attributes</entry>
<entry></entry>
</row>
<row>
<entry>node</entry>
<entry>domxml_node</entry>
<entry></entry>
</row>
<row>
<entry>set_content</entry>
<entry>domxml_set_content</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table>
<title>DomNode class (attributes)</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>node</entry>
<entry>class DomNode</entry>
<entry>The object itself</entry>
</row>
<row>
<entry>type</entry>
<entry>long</entry>
<entry></entry>
</row>
<row>
<entry>name</entry>
<entry>string</entry>
<entry></entry>
</row>
<row>
<entry>content</entry>
<entry>string</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</partintro>
<!-- class Dom document -->
<!-- has member functions
array root([int doc_handle])
returns array of root nodes of this document. Array
elements are objects of class "Dom node" having properties of
"node" (resource), "type" (long), "name" (string)
and optionally "content" (string).
array children([ int node ])
returns an array of child nodes of this element. Array
elements are objects of class "Dom node" having properties
of "node" (resource), "type" (long), "name" (string)
and optionally "content" (string).
object add_root([int doc_handle,] string name)
Add a root node to document.
returns an object of class "Dom node" having properties
of "node" (resource), "type" (long), "name" (string)
and optionally "content" (string).
object intdtd([int doc_handle])
returns the DTD of document.
returns an object of class "Dtd" having properties
of "dtd" (resource), "sysid" (string), "name" (string)
and optionally "extid" (string).
string dumpmem([int doc_handle])
dumps document into string.
-->
<!-- class Dom node
object lastchild([int node])
returns Dom node object
array children([int node])
as above
object parent([ int node])
returns Dom node object
(parent of this node)
new_child
string getattr([int node,] string attrname)
get value of attribute named attrname
bool setattr([int node,] string attrname, string value)
set value of given attribute.
array attributes([int node])
returns associative array of (string name, string value)
pairs.
object node(string name)
creates a named Dom node object.
-->
<!-- class Dom Attribute
name
-->
<!-- class Dom Namespace
-->
<!-- class Dtd
-->
<refentry id="function.xmldoc">
<refnamediv>
<refname>xmldoc</refname>
<refpurpose>Creates a DOM object of an XML document</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>xmldoc</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
The function parses the XML document in
<parameter>str</parameter> and returns an object of class "Dom
document", having the properties "doc" (resource), "version"
(string), "standalone" (long), "type" (long),
"compression" (long),
"charset" (long). If available the attributes "url" (string) and
"name" (string) are set as well.
</para>
</refsect1>
</refentry>
<refentry id="function.xmldocfile">
<refnamediv>
<refname>xmldocfile</refname>
<refpurpose>Creates a DOM object from XML file</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>xmldocfile</function></funcdef>
<paramdef>string <parameter>filename</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
The function parses the XML document in the file named
<parameter>filename</parameter> and returns an object of class
"Dom document", having the properties "doc" (resource), "version"
(string), "standalone" (long), "type" (long), "compression" (long),
"charset" (long). If available the attributes "url" (string) and "name"
(string) are set as well.
<!-- conspiciously the file attribute is missing? -->
</para>
</refsect1>
</refentry>
<refentry id="function.xmltree">
<refnamediv>
<refname>xmltree</refname>
<refpurpose>
Creates a tree of php objects from XML document
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>xmltree</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
The function parses the XML document in
<parameter>str</parameter> and returns a tree PHP objects as the
parsed document.
</para>
</refsect1>
</refentry>
<refentry id="function.domxml_root">
<refnamediv>
<refname>domxml_root</refname>
<refpurpose>
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>domxml_root</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
</para>
</refsect1>
</refentry>
<refentry id="function.domxml_add_root">
<refnamediv>
<refname>domxml_add_root</refname>
<refpurpose>
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>domxml_add_root</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
</para>
</refsect1>
</refentry>
<refentry id="function.domxml_dumpmem">
<refnamediv>
<refname>domxml_dumpmem</refname>
<refpurpose>
Dumps the internal XML tree back into a string
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>domxml_dumpmem</function></funcdef>
<paramdef>object <parameter>doc</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
</para>
</refsect1>
</refentry>
<refentry id="function.domxml_attributes">
<refnamediv>
<refname>domxml_attributes</refname>
<refpurpose>
Returns an array of attributes of a node
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>domxml_attributes</function></funcdef>
<paramdef>object <parameter>node</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
</para>
</refsect1>
</refentry>
<refentry id="function.domxml_get_attribute">
<refnamediv>
<refname>domxml_get_attribute</refname>
<refpurpose>
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>domxml_get_attribute</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
</para>
</refsect1>
</refentry>
<refentry id="function.domxml_set_attribute">
<refnamediv>
<refname>domxml_set_attribute</refname>
<refpurpose>
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>domxml_set_attribute</function></funcdef>
<paramdef>string <parameter>str</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
</para>
</refsect1>
</refentry>
<refentry id="function.domxml_children">
<refnamediv>
<refname>domxml_children</refname>
<refpurpose>
Returns children of a node or document
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>domxml_children</function></funcdef>
<paramdef>object <parameter>doc|node</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
</para>
</refsect1>
</refentry>
<refentry id="function.domxml_new_child">
<refnamediv>
<refname>domxml_new_child</refname>
<refpurpose>
Adds new child node
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>domxml_new_child</function></funcdef>
<paramdef>object <parameter>node</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
</para>
</refsect1>
</refentry>
<refentry id="function.domxml_new_xmldoc">
<refnamediv>
<refname>domxml_new_xmldoc</refname>
<refpurpose>
Creates new empty XML document
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>domxml_new_xmldoc</function></funcdef>
<paramdef>object <parameter>node</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
</para>
</refsect1>
</refentry>
<refentry id="function.domxml_node">
<refnamediv>
<refname>domxml_node</refname>
<refpurpose>
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>object <function>domxml_node</function></funcdef>
<paramdef>object <parameter>node</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
</para>
</refsect1>
</refentry>
</reference>
<!-- 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
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->