Document Object Model is a universal and standard interface for accessing content of XML and HTML documents. Functions are included also to build and modify dynamically the structure of such documents with scripts.
DOM may be used from JavaScript programs embedded into Web pages, or XUL interface or any XML-based tools that can support JavaScript.
DOM is a part of Ajax, and thus is essential to build Modern websites or Web applications. It is used to process XML files retrieved by XMLHttpRequest and to dynamically modify the content of Web pages with the data from these files. It may be used also to create an XML document from data entered in a form and send them to the server.
The DOM interface is a part of the PHP programming language and it may be used from Scriptol PHP programs too.
DOM has classes to build or access the structure of the document (node, nodelist), and classes to read of modify the data stored in the document (element, text).
The interface is made of these classes and methods, that are defined in the Scriptol interface:
DOMDocument
getElementByID() Returns the element with this ID property.
getElementsByTagName() Returns the list of elements with this tag name.
DOMElement
setAttribute() Gives an attribute to the tag.
DOMNode
DOMNodeList
item(n) Returns the n th node from a nodelist created by getElementsByTagName.
DOMText
Methods of DOMDocument added to PHP and not in the specification:
loadHTMLFile() Load a file into a DOMDocument.
save()Save the DOMDocument into an XML or a HTML file.