Class Document

Node
  |
  +--Document

public class Document
extends Node

Class representing the DOM Document interface.


Field Summary
private  DocumentType $doctype
          An instance of the DocumentType interface representing the DTD; If no DTD was declared in the document, this property is null.
DOM-Level 1
private  Element $documentElement
          Points to the single Element node that is the root of the XML tree.
DOM-Level 1
private  DOMImplementation $implementation
          An reference to the DOMImplementation that is responsible for this document.
DOM-Level 1
 
Fields inherited from class Node
$attributes, $childNodes, $firstChild, $lastChild, $localName, $namespaceURI, $nextSibling, $nodeID, $nodeName, $nodeType, $nodeValue, $ownerDocument, $parentNode, $prefix, $previousSibling, $readonly
 
Constructor Summary
Document()
          Constructor of the class.
 
Method Summary
 Attr createAttribute(var $name)
          Creates an Attribute node.
DOM-Level 1
 Attr createAttributeNS(var $namespaceURI, var $qualifiedName)
          Same as createAttribute, but includes support for XML namespaces.
DOM-Level 2
 CDataSection createCDataSection(var $data)
          Creates a CDataSection node.
DOM-Level 1
 Comment createComment(var $data)
          Creates a Comment node.
DOM-Level 1
 DocumentFragment createDocumentFragment()
          Creates a DocumentFragment node.
DOM-Level 1
 Element createElement(var $tagName)
          Creates an Element node.
DOM-Level 1
 Element createElementNS(var $namespaceURI, var $qualifiedName)
          Same as createElement, but includes support for XML namespaces.
DOM-Level 2
 EntityReference createEntityReference(var $name)
          Creates an EntityReference node (not supported yet)
DOM-Level 1
 ProcessingInstruction createProcessingInstruction(var $target, var $data)
          Creates a ProcessingInstruction node.
DOM-Level 1
 Text createTextNode(var $data)
          Creates a Text node.
DOM-Level 1
 DocumentType getDoctype()
          Returns an reference to the DocumentType object.
DOM-Level 1
 Element getDocumentElement()
          Returns an reference to the root element.
DOM-Level 1
 Element getElementById(var $elementID)
          Returns a Element node from the current document whose id attribute matches the given id.
DOM-Level 2 -- NYI
private  void getElementByIdHelp(var $id, var $dtd, var $parent)
          Runs recursively through the DOM-Tree and returns the element with attribute id.
 NodeList getElementsByTagName(var $tagName)
          Returns a NodeList of Element nodes from the current document whose tagName attribute matches the given tagname.
DOM-Level 1
private  void getElementsByTagNameList(var $tagName, var $parent, var $result)
          Runs recursively through the DOM-Tree and returns a NodeList with all Element nodes that have the searched tagname.
 NodeList getElementsByTagNameNS(var $namespaceURI, var $localName)
          Same as getElementByTagName, but includes support for XML namespaces.
DOM-Level 2
private  void getElementsByTagNameNSList(var $namespaceURI, var $localName, var $parent, var $result)
          Runs recursively through the DOM-Tree and returns a NodeList with all Element nodes that have the searched $namespaceURI and $localName.
 DOMImplementation getImplementation()
          Returns an reference to the DOMImplementation object.
DOM-Level 1
 Node importNode(var $importedNode, var $deep)
          Creates a copy of a Node object from another document that can be inserted within the current documents node hierarchy.
DOM-Level 2
 
Methods inherited from class Node
appendChild, checkDocument, checkHierarchy, cloneNode, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 

Field Detail

$doctype

private DocumentType $doctype
An instance of the DocumentType interface representing the DTD; If no DTD was declared in the document, this property is null.
DOM-Level 1

$documentElement

private Element $documentElement
Points to the single Element node that is the root of the XML tree.
DOM-Level 1

$implementation

private DOMImplementation $implementation
An reference to the DOMImplementation that is responsible for this document.
DOM-Level 1
Constructor Detail

Document

public Document()
Constructor of the class.
Method Detail

getDoctype

public DocumentType getDoctype()
Returns an reference to the DocumentType object.
DOM-Level 1

getDocumentElement

public Element getDocumentElement()
Returns an reference to the root element.
DOM-Level 1

getImplementation

public DOMImplementation getImplementation()
Returns an reference to the DOMImplementation object.
DOM-Level 1

createAttribute

public Attr createAttribute(var $name)
Creates an Attribute node.
DOM-Level 1
Parameters:
$name - string
$value - string

createCDataSection

public CDataSection createCDataSection(var $data)
Creates a CDataSection node.
DOM-Level 1
Parameters:
$data -  

createComment

public Comment createComment(var $data)
Creates a Comment node.
DOM-Level 1
Parameters:
$data - string

createDocumentFragment

public DocumentFragment createDocumentFragment()
Creates a DocumentFragment node.
DOM-Level 1

createElement

public Element createElement(var $tagName)
Creates an Element node.
DOM-Level 1
Parameters:
$tagName - string

createEntityReference

public EntityReference createEntityReference(var $name)
Creates an EntityReference node (not supported yet)
DOM-Level 1
Parameters:
$name - string

createProcessingInstruction

public ProcessingInstruction createProcessingInstruction(var $target,
                                                         var $data)
Creates a ProcessingInstruction node.
DOM-Level 1
Parameters:
$target - string
$data - string

createTextNode

public Text createTextNode(var $data)
Creates a Text node.
DOM-Level 1
Parameters:
$data - string

getElementsByTagName

public NodeList getElementsByTagName(var $tagName)
Returns a NodeList of Element nodes from the current document whose tagName attribute matches the given tagname.
DOM-Level 1
Parameters:
$tagName - string

createAttributeNS

public Attr createAttributeNS(var $namespaceURI,
                              var $qualifiedName)
Same as createAttribute, but includes support for XML namespaces.
DOM-Level 2
Parameters:
$namespaceURI - string
$qualifiedName - string

createElementNS

public Element createElementNS(var $namespaceURI,
                               var $qualifiedName)
Same as createElement, but includes support for XML namespaces.
DOM-Level 2
Parameters:
$namespaceURI - string
$qualifiedName - string

getElementById

public Element getElementById(var $elementID)
Returns a Element node from the current document whose id attribute matches the given id.
DOM-Level 2 -- NYI
Parameters:
$elementID - string

getElementsByTagNameNS

public NodeList getElementsByTagNameNS(var $namespaceURI,
                                       var $localName)
Same as getElementByTagName, but includes support for XML namespaces.
DOM-Level 2
Parameters:
$namespaceURI - string
$localName - string

importNode

public Node importNode(var $importedNode,
                       var $deep)
Creates a copy of a Node object from another document that can be inserted within the current documents node hierarchy.
DOM-Level 2
Parameters:
$importedNode - Node
$deep - boolean
$importedNode - is passed by reference

getElementByIdHelp

private void getElementByIdHelp(var $id,
                                var $dtd,
                                var $parent)
Runs recursively through the DOM-Tree and returns the element with attribute id.
Parameters:
$tagName - string
$id - boolean
$parent - Node
$parent - is passed by reference

getElementsByTagNameList

private void getElementsByTagNameList(var $tagName,
                                      var $parent,
                                      var $result)
Runs recursively through the DOM-Tree and returns a NodeList with all Element nodes that have the searched tagname.
Parameters:
$tagName - string
$parent - Node
$result - NodeList
$parent - is passed by reference
$result - is passed by reference

getElementsByTagNameNSList

private void getElementsByTagNameNSList(var $namespaceURI,
                                        var $localName,
                                        var $parent,
                                        var $result)
Runs recursively through the DOM-Tree and returns a NodeList with all Element nodes that have the searched $namespaceURI and $localName.
Parameters:
$namespaceURI - string
$localName - string
$parent - Node
$result - NodeList
$parent - is passed by reference
$result - is passed by reference