Manual PHP
Înapoi
Înainte
XXV.
DOM XML functions
Avertisment
Această extensie este EXPERIMENTALĂ.
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.
This documentation is not finished yet.
Don' t start to translate it or use it as a programming reference (steinm@php.net).
These functions are only available if PHP was configured with --with-dom=[ DIR], using the GNOME xml library.
You will need at least libxml-2.2.7 These functions have been added in PHP 4.
It also provides a function xmltree() 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 dumpmem() cannot be applied to it.
Therefore, if you want to read an XML file and write a modified version use the add_node(), set_attribute(), etc. and finally dumpmem() functions.
This module defines the following constants:
Tabel 1.
XML_ELEMENT_NODE
XML_ATTRIBUTE_NODE
XML_TEXT_NODE
XML_CDATA_SECTION_NODE
XML_ENTITY_REF_NODE
XML_ENTITY_NODE
XML_PI_NODE
XML_COMMENT_NODE
XML_DOCUMENT_NODE
XML_DOCUMENT_TYPE_NODE
XML_DOCUMENT_FRAG_NODE
XML_NOTATION_NODE
XML_GLOBAL_NAMESPACE
XML_LOCAL_NAMESPACE
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_".
This module defines a number of classes, which are listed — including their properties and method — in the following table.
Tabel 2.
DomDocument class (methods)
root
domxml_root()
children
domxml_children()
add_root
domxml_add_root()
dtd
domxml_intdtd()
dumpmem
domxml()
Tabel 3.
DomDocument class (attributes)
Name
Type
doc
class DomDocument
The object itself
string
url
string
version
string
Version of XML
encoding
string
standalone
long
1 if the file is a standalone version
type
long
One of the constants in table...
compression
long
1 if the file is compressed
charset
long
Tabel 4.
DomNode class (methods)
Name
PHP name
lastchild
domxml_last_child()
children
domxml_children()
parent
domxml_parent()
new_child
domxml_new_child()
domxml_get_attribute()
domxml_set_attribute()
attributes
domxml_attributes()
node
domxml_node()
set_content()
domxml_set_content
Tabel 5.
DomNode class (attributes)
Name
Type
node
class DomNode
The object itself
type
long
string
content
string
DomDocumentType - entities
DomNode - append_child
DomNode - unlink_node
DomXsltStylesheet - result_dump_file
Înapoi
Acasã
Înainte
Sus