Classes
The API of the module follows the DOM Level 2 standard as
closely as possible. Consequently, the API is fully object-oriented.
It is a good idea to have the DOM standard available when
using this module. Though the API is object-oriented, there
are many functions which can be called in a non-object-oriented
way by passing the object to operate on as the first argument.
These functions are mainly to retain compatibility to older
versions of the extension, and should not be used when creating
new scripts.
This API differs from the official DOM API in two ways.
First, all class attributes are implemented as functions
with the same name. Secondly, the function names follow
the PHP naming convention. This means that a DOM function
lastChild() will be written as last_child().
This module defines a number of classes, which are listed
- including their method - in the following tables. Classes
with an equivalent in the DOM standard are named DOMxxx.
Table 3. List of classes
Class name Parent classes
DomAttribute DomNode
DomCData DomNode
DomComment DomCData : DomNode
DomDocument DomNode
DomDocumentType DomNode
DomElement DomNode
DomEntity DomNode
DomEntityReference DomNode
DomProcessingInstruction DomNode
DomText DomCData : DomNode
Parser Currently still called DomParser
XPathContext
Table 4. DomDocument class (DomDocument : DomNode)
Method name Function name Remark
doctype DomDocument_doctype()
document_element DomDocument_document_element()
create_element DomDocument_create_element()
create_text_node DomDocument_create_text_node()
create_comment DomDocument_create_comment()
create_cdata_section DomDocument_create_cdata_section()
create_processing_instruction DomDocument_create_processing_instruction()
create_attribute DomDocument_create_attribute()
create_entity_reference DomDocument_create_entity_reference()
get_elements_by_tagname DomDocument_get_elements_by_tagname()
get_element_by_id DomDocument_get_element_by_id()
dump_mem DomDocument_dump_mem() not DOM standard
dump_file DomDocument_dump_file() not DOM standard
html_dump_mem DomDocument_html_dump_mem() not DOM standard
xpath_init xpath_init not DOM standard
xpath_new_context xpath_new_context not DOM standard
xptr_new_context xptr_new_context not DOM standard
|