<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >DOM XML functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual PHP" HREF="index.html"><LINK REL="UP" TITLE="Documentaþia funcþiilor" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="DOMXPath->registerNamespace" HREF="function.dom-domxpath-registernamespace.html"><LINK REL="NEXT" TITLE="DomAttribute->name" HREF="function.domattribute-name.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-2"></HEAD ><BODY CLASS="reference" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.dom-domxpath-registernamespace.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.domattribute-name.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.domxml" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >XXV. DOM XML functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN22802" ></A ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Avertisment</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P >Aceastã extensie este <SPAN CLASS="emphasis" ><I CLASS="emphasis" >EXPERIMENTALÃ</I ></SPAN >. Comportamentul acestei extensii, incluzând numele funcþiilor ºi orice altceva documentat despre aceastã extensie ar putea fi schimbate farã un anunþ prealabil, intr-o viitoare versiune PHP. V-am avertizat, deci folosiþi aceastã extensie pe riscul dv.</P ></TD ></TR ></TABLE ></DIV ><P > This documentation is not finished yet. Don't start to translate it or use it as a programming reference (steinm@php.net). </P ><P > These functions are only available if PHP was configured with <VAR CLASS="option" >--with-dom=[DIR]</VAR >, using the <A HREF="http://www.xmlsoft.org/" TARGET="_top" >GNOME xml library</A >. You will need at least libxml-2.2.7 These functions have been added in PHP 4. </P ><P > The extension allows you to operate on an XML document with the DOM API. It also provides a function <B CLASS="function" >xmltree()</B > to turn the complete XML document into a tree of PHP objects. Currently this tree should be considered read-only - you can modify it but this would not make any sense since <B CLASS="function" >dumpmem()</B > cannot be applied to it. Therefore, if you want to read an XML file and write a modified version use the <B CLASS="function" >add_node()</B >, <B CLASS="function" >set_attribute()</B >, etc. and finally <B CLASS="function" >dumpmem()</B > functions. </P ><P > This module defines the following constants: </P ><DIV CLASS="table" ><A NAME="AEN22817" ></A ><P ><B >Tabel 1. XML constants</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Constant</TH ><TH >Value</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD >XML_ELEMENT_NODE</TD ><TD >1</TD ><TD >Node is an element</TD ></TR ><TR ><TD >XML_ATTRIBUTE_NODE</TD ><TD >2</TD ><TD >Node is an attribute</TD ></TR ><TR ><TD >XML_TEXT_NODE</TD ><TD >3</TD ><TD >Node is a piece of text</TD ></TR ><TR ><TD >XML_CDATA_SECTION_NODE</TD ><TD >4</TD ><TD > </TD ></TR ><TR ><TD >XML_ENTITY_REF_NODE</TD ><TD >5</TD ><TD > </TD ></TR ><TR ><TD >XML_ENTITY_NODE</TD ><TD >6</TD ><TD >Node is an entity like &nbsp;</TD ></TR ><TR ><TD >XML_PI_NODE</TD ><TD >7</TD ><TD >Node is a processing instruction</TD ></TR ><TR ><TD >XML_COMMENT_NODE</TD ><TD >8</TD ><TD >Node is a comment</TD ></TR ><TR ><TD >XML_DOCUMENT_NODE</TD ><TD >9</TD ><TD >Node is a document</TD ></TR ><TR ><TD >XML_DOCUMENT_TYPE_NODE</TD ><TD >10</TD ><TD > </TD ></TR ><TR ><TD >XML_DOCUMENT_FRAG_NODE</TD ><TD >11</TD ><TD > </TD ></TR ><TR ><TD >XML_NOTATION_NODE</TD ><TD >12</TD ><TD > </TD ></TR ><TR ><TD >XML_GLOBAL_NAMESPACE</TD ><TD >1</TD ><TD > </TD ></TR ><TR ><TD >XML_LOCAL_NAMESPACE</TD ><TD >2</TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV ><P > Each function in this extension can be used in two ways. In a non-object oriented way by passing the object to apply the function to as a first argument, or in an object oriented way by calling the function as a method of an object. This documentation describes the non-object oriented functions, though you get the object methods by skipping the prefix "domxml_". </P ><P > This module defines a number of classes, which are listed — including their properties and method — in the following table. </P ><P > <DIV CLASS="table" ><A NAME="AEN22885" ></A ><P ><B >Tabel 2. DomDocument class (methods)</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Method name</TH ><TH >Function name</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD >root</TD ><TD ><B CLASS="function" >domxml_root()</B ></TD ><TD > </TD ></TR ><TR ><TD >children</TD ><TD ><B CLASS="function" >domxml_children()</B ></TD ><TD > </TD ></TR ><TR ><TD >add_root</TD ><TD ><B CLASS="function" >domxml_add_root()</B ></TD ><TD > </TD ></TR ><TR ><TD >dtd</TD ><TD ><B CLASS="function" >domxml_intdtd()</B ></TD ><TD > </TD ></TR ><TR ><TD >dumpmem</TD ><TD ><B CLASS="function" >domxml()</B ></TD ><TD > </TD ></TR ><TR ><TD >xpath_init</TD ><TD >xpath_init</TD ><TD > </TD ></TR ><TR ><TD >xpath_new_context</TD ><TD >xpath_new_context</TD ><TD > </TD ></TR ><TR ><TD >xptr_new_context</TD ><TD >xptr_new_context</TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV > </P ><P > <DIV CLASS="table" ><A NAME="AEN22932" ></A ><P ><B >Tabel 3. DomDocument class (attributes)</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Name</TH ><TH >Type</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD >doc</TD ><TD >class DomDocument</TD ><TD >The object itself</TD ></TR ><TR ><TD >name</TD ><TD >string</TD ><TD > </TD ></TR ><TR ><TD >url</TD ><TD >string</TD ><TD > </TD ></TR ><TR ><TD >version</TD ><TD >string</TD ><TD >Version of XML</TD ></TR ><TR ><TD >encoding</TD ><TD >string</TD ><TD > </TD ></TR ><TR ><TD >standalone</TD ><TD >long</TD ><TD >1 if the file is a standalone version</TD ></TR ><TR ><TD >type</TD ><TD >long</TD ><TD >One of the constants in table ... </TD ></TR ><TR ><TD >compression</TD ><TD >long</TD ><TD >1 if the file is compressed</TD ></TR ><TR ><TD >charset</TD ><TD >long</TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV > </P ><P > <DIV CLASS="table" ><A NAME="AEN22978" ></A ><P ><B >Tabel 4. DomNode class (methods)</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Name</TH ><TH >PHP name</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD >lastchild</TD ><TD ><B CLASS="function" >domxml_last_child()</B ></TD ><TD > </TD ></TR ><TR ><TD >children</TD ><TD ><B CLASS="function" >domxml_children()</B ></TD ><TD > </TD ></TR ><TR ><TD >parent</TD ><TD ><B CLASS="function" >domxml_parent()</B ></TD ><TD > </TD ></TR ><TR ><TD >new_child</TD ><TD ><B CLASS="function" >domxml_new_child()</B ></TD ><TD > </TD ></TR ><TR ><TD >get_attribute</TD ><TD ><B CLASS="function" >domxml_get_attribute()</B ></TD ><TD > </TD ></TR ><TR ><TD >set_attribute</TD ><TD ><B CLASS="function" >domxml_set_attribute()</B ></TD ><TD > </TD ></TR ><TR ><TD >attributes</TD ><TD ><B CLASS="function" >domxml_attributes()</B ></TD ><TD > </TD ></TR ><TR ><TD >node</TD ><TD ><B CLASS="function" >domxml_node()</B ></TD ><TD > </TD ></TR ><TR ><TD ><B CLASS="function" >set_content()</B ></TD ><TD >domxml_set_content</TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV > </P ><P > <DIV CLASS="table" ><A NAME="AEN23033" ></A ><P ><B >Tabel 5. DomNode class (attributes)</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Name</TH ><TH >Type</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD >node</TD ><TD >class DomNode</TD ><TD >The object itself</TD ></TR ><TR ><TD >type</TD ><TD >long</TD ><TD > </TD ></TR ><TR ><TD >tagname</TD ><TD >string</TD ><TD > </TD ></TR ><TR ><TD >content</TD ><TD >string</TD ><TD > </TD ></TR ></TBODY ></TABLE ></DIV > </P ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Cuprins</B ></DT ><DT ><A HREF="function.domattribute-name.html" >DomAttribute->name</A > -- Returns name of attribute </DT ><DT ><A HREF="function.domattribute-specified.html" >DomAttribute->specified</A > -- Checks if attribute is specified </DT ><DT ><A HREF="function.domattribute-value.html" >DomAttribute->value</A > -- Returns value of attribute </DT ><DT ><A HREF="function.domdocument-add-root.html" >DomDocument->add_root</A > -- Adds a root node [deprecated] </DT ><DT ><A HREF="function.domdocument-create-attribute.html" >DomDocument->create_attribute</A > -- Create new attribute</DT ><DT ><A HREF="function.domdocument-create-cdata-section.html" >DomDocument->create_cdata_section</A > -- Create new cdata node</DT ><DT ><A HREF="function.domdocument-create-comment.html" >DomDocument->create_comment</A > -- Create new comment node</DT ><DT ><A HREF="function.domdocument-create-element-ns.html" >DomDocument->create_element_ns</A > -- Create new element node with an associated namespace </DT ><DT ><A HREF="function.domdocument-create-element.html" >DomDocument->create_element</A > -- Create new element node</DT ><DT ><A HREF="function.domdocument-create-entity-reference.html" >DomDocument->create_entity_reference</A > -- </DT ><DT ><A HREF="function.domdocument-create-processing-instruction.html" >DomDocument->create_processing_instruction</A > -- Creates new PI node</DT ><DT ><A HREF="function.domdocument-create-text-node.html" >DomDocument->create_text_node</A > -- Create new text node</DT ><DT ><A HREF="function.domdocument-doctype.html" >DomDocument->doctype</A > -- Returns the document type </DT ><DT ><A HREF="function.domdocument-document-element.html" >DomDocument->document_element</A > -- Returns root element node </DT ><DT ><A HREF="function.domdocument-dump-file.html" >DomDocument->dump_file</A > -- Dumps the internal XML tree back into a file </DT ><DT ><A HREF="function.domdocument-dump-mem.html" >DomDocument->dump_mem</A > -- Dumps the internal XML tree back into a string </DT ><DT ><A HREF="function.domdocument-get-element-by-id.html" >DomDocument->get_element_by_id</A > -- Searches for an element with a certain id </DT ><DT ><A HREF="function.domdocument-get-elements-by-tagname.html" >DomDocument->get_elements_by_tagname</A > -- </DT ><DT ><A HREF="function.domdocument-html-dump-mem.html" >DomDocument->html_dump_mem</A > -- Dumps the internal XML tree back into a string as HTML </DT ><DT ><A HREF="function.domdocument-xinclude.html" >DomDocument->xinclude</A > -- Substitutes XIncludes in a DomDocument Object. </DT ><DT ><A HREF="function.domdocumenttype-entities.html" >DomDocumentType->entities</A > -- Returns list of entities </DT ><DT ><A HREF="function.domdocumenttype-internal-subset.html" >DomDocumentType->internal_subset</A > -- Returns internal subset </DT ><DT ><A HREF="function.domdocumenttype-name.html" >DomDocumentType->name</A > -- Returns name of document type </DT ><DT ><A HREF="function.domdocumenttype-notations.html" >DomDocumentType->notations</A > -- Returns list of notations </DT ><DT ><A HREF="function.domdocumenttype-public-id.html" >DomDocumentType->public_id</A > -- Returns public id of document type </DT ><DT ><A HREF="function.domdocumenttype-system-id.html" >DomDocumentType->system_id</A > -- Returns system id of document type </DT ><DT ><A HREF="function.domelement-get-attribute-node.html" >DomElement->get_attribute_node</A > -- Returns value of attribute </DT ><DT ><A HREF="function.domelement-get-attribute.html" >DomElement->get_attribute</A > -- Returns value of attribute </DT ><DT ><A HREF="function.domelement-get-elements-by-tagname.html" >DomElement->get_elements_by_tagname</A > -- Gets elements by tagname </DT ><DT ><A HREF="function.domelement-has-attribute.html" >DomElement->has_attribute</A > -- Checks to see if attribute exists </DT ><DT ><A HREF="function.domelement-remove-attribute.html" >DomElement->remove_attribute</A > -- Removes attribute </DT ><DT ><A HREF="function.domelement-set-attribute.html" >DomElement->set_attribute</A > -- Adds new attribute </DT ><DT ><A HREF="function.domelement-tagname.html" >DomElement->tagname</A > -- Returns name of element </DT ><DT ><A HREF="function.domnode-add-namespace.html" >DomNode->add_namespace</A > -- Adds a namespace declaration to a node. </DT ><DT ><A HREF="function.domnode-append-child.html" >DomNode->append_child</A > -- Adds new child at the end of the children </DT ><DT ><A HREF="function.domnode-append-sibling.html" >DomNode->append_sibling</A > -- Adds new sibling to a node </DT ><DT ><A HREF="function.domnode-attributes.html" >DomNode->attributes</A > -- Returns list of attributes </DT ><DT ><A HREF="function.domnode-child-nodes.html" >DomNode->child_nodes</A > -- Returns children of node </DT ><DT ><A HREF="function.domnode-clone-node.html" >DomNode->clone_node</A > -- Clones a node </DT ><DT ><A HREF="function.domnode-dump-node.html" >DomNode->dump_node</A > -- Dumps a single node </DT ><DT ><A HREF="function.domnode-first-child.html" >DomNode->first_child</A > -- Returns first child of node </DT ><DT ><A HREF="function.domnode-get-content.html" >DomNode->get_content</A > -- Gets content of node </DT ><DT ><A HREF="function.domnode-has-attributes.html" >DomNode->has_attributes</A > -- Checks if node has attributes </DT ><DT ><A HREF="function.domnode-has-child-nodes.html" >DomNode->has_child_nodes</A > -- Checks if node has children </DT ><DT ><A HREF="function.domnode-insert-before.html" >DomNode->insert_before</A > -- Inserts new node as child </DT ><DT ><A HREF="function.domnode-is-blank-node.html" >DomNode->is_blank_node</A > -- Checks if node is blank </DT ><DT ><A HREF="function.domnode-last-child.html" >DomNode->last_child</A > -- Returns last child of node </DT ><DT ><A HREF="function.domnode-next-sibling.html" >DomNode->next_sibling</A > -- Returns the next sibling of node </DT ><DT ><A HREF="function.domnode-node-name.html" >DomNode->node_name</A > -- Returns name of node </DT ><DT ><A HREF="function.domnode-node-type.html" >DomNode->node_type</A > -- Returns type of node </DT ><DT ><A HREF="function.domnode-node-value.html" >DomNode->node_value</A > -- Returns value of a node </DT ><DT ><A HREF="function.domnode-owner-document.html" >DomNode->owner_document</A > -- Returns the document this node belongs to </DT ><DT ><A HREF="function.domnode-parent-node.html" >DomNode->parent_node</A > -- Returns the parent of the node </DT ><DT ><A HREF="function.domnode-prefix.html" >DomNode->prefix</A > -- Returns name space prefix of node </DT ><DT ><A HREF="function.domnode-previous-sibling.html" >DomNode->previous_sibling</A > -- Returns the previous sibling of node </DT ><DT ><A HREF="function.domnode-remove-child.html" >DomNode->remove_child</A > -- Removes child from list of children </DT ><DT ><A HREF="function.domnode-replace-child.html" >DomNode->replace_child</A > -- Replaces a child </DT ><DT ><A HREF="function.domnode-replace-node.html" >DomNode->replace_node</A > -- Replaces node </DT ><DT ><A HREF="function.domnode-set-content.html" >DomNode->set_content</A > -- Sets content of node </DT ><DT ><A HREF="function.domnode-set-name.html" >DomNode->set_name</A > -- Sets name of node </DT ><DT ><A HREF="function.domnode-set-namespace.html" >DomNode->set_namespace</A > -- Sets namespace of a node. </DT ><DT ><A HREF="function.domnode-unlink-node.html" >DomNode->unlink_node</A > -- Deletes node </DT ><DT ><A HREF="function.domprocessinginstruction-data.html" >DomProcessingInstruction->data</A > -- Returns data of pi node </DT ><DT ><A HREF="function.domprocessinginstruction-target.html" >DomProcessingInstruction->target</A > -- Returns target of pi node </DT ><DT ><A HREF="function.domxsltstylesheet-process.html" >DomXsltStylesheet->process</A > -- Applies the XSLT-Transformation on a DomDocument Object. </DT ><DT ><A HREF="function.domxsltstylesheet-result-dump-file.html" >DomXsltStylesheet->result_dump_file</A > -- Dumps the result from a XSLT-Transformation into a file </DT ><DT ><A HREF="function.domxsltstylesheet-result-dump-mem.html" >DomXsltStylesheet->result_dump_mem</A > -- Dumps the result from a XSLT-Transformation back into a string </DT ><DT ><A HREF="function.domxml-new-doc.html" >domxml_new_doc</A > -- Creates new empty XML document </DT ><DT ><A HREF="function.domxml-open-file.html" >domxml_open_file</A > -- Creates a DOM object from XML file</DT ><DT ><A HREF="function.domxml-open-mem.html" >domxml_open_mem</A > -- Creates a DOM object of an XML document</DT ><DT ><A HREF="function.domxml-version.html" >domxml_version</A > -- Get XML library version </DT ><DT ><A HREF="function.domxml-xmltree.html" >domxml_xmltree</A > -- Creates a tree of PHP objects from an XML document </DT ><DT ><A HREF="function.domxml-xslt-stylesheet-doc.html" >domxml_xslt_stylesheet_doc</A > -- Creates a DomXsltStylesheet Object from a DomDocument Object. </DT ><DT ><A HREF="function.domxml-xslt-stylesheet-file.html" >domxml_xslt_stylesheet_file</A > -- Creates a DomXsltStylesheet Object from an XSL document in a file. </DT ><DT ><A HREF="function.domxml-xslt-stylesheet.html" >domxml_xslt_stylesheet</A > -- Creates a DomXsltStylesheet Object from an XML document in a string. </DT ><DT ><A HREF="function.xpath-eval-expression.html" >xpath_eval_expression</A > -- Evaluates the XPath Location Path in the given string </DT ><DT ><A HREF="function.xpath-eval.html" >xpath_eval</A > -- Evaluates the XPath Location Path in the given string </DT ><DT ><A HREF="function.xpath-new-context.html" >xpath_new_context</A > -- Creates new xpath context </DT ><DT ><A HREF="function.xptr-eval.html" >xptr_eval</A > -- Evaluate the XPtr Location Path in the given string </DT ><DT ><A HREF="function.xptr-new-context.html" >xptr_new_context</A > -- Create new XPath Context </DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.dom-domxpath-registernamespace.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Acasã</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.domattribute-name.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >DOMXPath->registerNamespace</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >Sus</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >DomAttribute->name</TD ></TR ></TABLE ></DIV ></BODY ></HTML >