Class Node

Node
Direct Known Subclasses:
Attr, CharacterData, Document, DocumentFragment, DocumentType, Element, Entity, EntityReference, Notation, ProcessingInstruction

public class Node

Class representing the DOM Node interface


Field Summary
private  NamedNodeMap $attributes
          Provides access to a list of Attr objects in a NamedNodeMap.
DOM-Level 1
private  NodeList $childNodes
          A NodeList containing a reference to every child in this Node.
DOM-Level 1
private  Node $firstChild
          Points to the head of the linked list of children in this node.
DOM-Level 1
private  Node $lastChild
          Points to the end of the linked list of children in the node.
DOM-Level 1
private  string $localName
          Contains the local part of the fully qualified node name.
DOM-Level 2
private  string $namespaceURI
          The namespace URI given to this Node object at creation time, null if no namespace was given.
DOM-Level 2
private  Node $nextSibling
          Points to the next Node in the siblings list.
DOM-Level 1
private  string $nodeID
          Identifier to compare two nodes.
private  string $nodeName
          Depending on the object type (nodeType), this attribute may map to another attribute of the object or a constant string.
DOM-Level 1
private  int $nodeType
          Contains a value that indicates the true type of the Node.
DOM-Level 1
private  string $nodeValue
          Depending on the nodeType, this attribute contains null or the content/value of the node.
DOM-Level 1
private  Document $ownerDocument
          Points to the Document used to create this Node object.
DOM-Level 1
private  Node $parentNode
          Points to the parent of this node.
DOM-Level 1
private  string $prefix
          The namespace prefix of this Node, used for nodes that support namespace prefixes.
DOM-Level 2
private  Node $previousSibling
          Points to the previous Node in the siblings list.
DOM-Level 1
private  boolean $readonly
          Mark this node as a readonly node.
 
Constructor Summary
Node()
          Constructor of the class.
 
Method Summary
 Node appendChild(var $newChild)
          Appends the $newChild node to the end of the child list if the node is a permitted child of this node.
DOM-Level 1
private  int checkDocument(var $child)
          Checks, if the node $child was created from the same document than this node.
private  int checkHierarchy(var $child)
          Checks, if the node $child is a permitted child object of the DOM hierarchy.
 Node cloneNode(var $deep)
          Returns a copy of the node without the parent node; If $deep is true, all children are also copied.
DOM-Level 1
private  Node cloneNode(var $deep, var $ownerDocument)
          Internal function for cloning a node.
 NamedNodeMap getAttributes()
          Provides access to a list of Attr objects in a NamedNodeMap.
DOM-Level 1
 NodeList getChildNodes()
          Returns a NodeList containing a reference to every child in this Node.
DOM-Level 1
 Node getFirstChild()
          Returns a reference to the head of the linked list of children in this node.
DOM-Level 1
 Node getLastChild()
          Returns a reference to the end of the linked list of children in this node.
DOM-Level 1
 string getLocalName()
          Returns the local part of the fully qualified node name.
DOM-Level 2
 string getNamespaceURI()
          Returns the namespace URI of this node.
DOM-Level 2
 Node getNextSibling()
          Returns a reference to the next node in the siblings list.
DOM-Level 1
 string getNodeName()
          Returns the name of the node or null if the node has no name.
DOM-Level 1
 int getNodeType()
          Returns the type of the node.
DOM-Level 1
 string getNodeValue()
          Returns the value of the node or null if the node has no value.
DOM-Level 1
 Document getOwnerDocument()
          Returns a reference to the Document used to create this node.
DOM-Level 1
 Node getParentNode()
          Returns the parent of this node.
DOM-Level 1
 string getPrefix()
          Returns the namespace prefix of this node.
DOM-Level 2
 Node getPreviousSibling()
          Returns the previous node in the siblings list.
DOM-Level 1
 boolean hasAttributes()
          Indicates whether an Element node has any attributes.
DOM-Level 2
 boolean hasChildNodes()
          This method provides a quick way to check if a node has children.
DOM-Level 1
 Node insertBefore(var $newChild, var $refChild)
          Inserts the Node object $newChild into the child list of the parent node; The $refChild parameter allows you to specify where to insert the new node; If $refChild is null, newChild is inserted at the end of the child list; If $newChild is linked into the document tree, it is removed before it is inserted in its new position.
DOM-Level 1
 boolean isSupported(var $feature, var $version)
          Checks to see if a particular DOM feature is available for this implementation.
DOM-Level 2
 void normalize()
          Recursively combines all adjacent Text nodes into a single node; It also removes empty Text nodes from the document tree.
DOM-Level 2
 Node removeChild(var $oldChild)
          Unlinks the $oldChild node from the child list.
DOM-Level 1
 Node replaceChild(var $newChild, var $oldChild)
          Replaces the child node $oldChild with $newChild; If $newChild is linked into the document tree, it is removed before the replace is performed.
DOM-Level 1
 void setNodeValue(var $nodeValue)
          Sets the value of this node.
DOM-Level 1
 void setPrefix(var $prefix)
          Changes the prefix of this node; For ELEMENT_NODE and ATTRIBUTE_NODE type nodes, changing the namespace prefix also affects the nodeName, tagName and name attributes.
DOM-Level 2
 

Field Detail

$nodeID

private string $nodeID
Identifier to compare two nodes. This ID is necessary to compare two nodes, because the operator == is not implemented for objects/references in PHP4.

$attributes

private NamedNodeMap $attributes
Provides access to a list of Attr objects in a NamedNodeMap.
DOM-Level 1

$childNodes

private NodeList $childNodes
A NodeList containing a reference to every child in this Node.
DOM-Level 1

$firstChild

private Node $firstChild
Points to the head of the linked list of children in this node.
DOM-Level 1

$lastChild

private Node $lastChild
Points to the end of the linked list of children in the node.
DOM-Level 1

$nextSibling

private Node $nextSibling
Points to the next Node in the siblings list.
DOM-Level 1

$nodeName

private string $nodeName
Depending on the object type (nodeType), this attribute may map to another attribute of the object or a constant string.
DOM-Level 1

$nodeType

private int $nodeType
Contains a value that indicates the true type of the Node.
DOM-Level 1

$nodeValue

private string $nodeValue
Depending on the nodeType, this attribute contains null or the content/value of the node.
DOM-Level 1

$ownerDocument

private Document $ownerDocument
Points to the Document used to create this Node object.
DOM-Level 1

$parentNode

private Node $parentNode
Points to the parent of this node.
DOM-Level 1

$previousSibling

private Node $previousSibling
Points to the previous Node in the siblings list.
DOM-Level 1

$localName

private string $localName
Contains the local part of the fully qualified node name.
DOM-Level 2

$namespaceURI

private string $namespaceURI
The namespace URI given to this Node object at creation time, null if no namespace was given.
DOM-Level 2

$prefix

private string $prefix
The namespace prefix of this Node, used for nodes that support namespace prefixes.
DOM-Level 2

$readonly

private boolean $readonly
Mark this node as a readonly node.
Constructor Detail

Node

public Node()
Constructor of the class.
Method Detail

getAttributes

public NamedNodeMap getAttributes()
Provides access to a list of Attr objects in a NamedNodeMap.
DOM-Level 1

getChildNodes

public NodeList getChildNodes()
Returns a NodeList containing a reference to every child in this Node.
DOM-Level 1

getFirstChild

public Node getFirstChild()
Returns a reference to the head of the linked list of children in this node.
DOM-Level 1

getLastChild

public Node getLastChild()
Returns a reference to the end of the linked list of children in this node.
DOM-Level 1

getNextSibling

public Node getNextSibling()
Returns a reference to the next node in the siblings list.
DOM-Level 1

getNodeName

public string getNodeName()
Returns the name of the node or null if the node has no name.
DOM-Level 1

getNodeType

public int getNodeType()
Returns the type of the node.
DOM-Level 1

getNodeValue

public string getNodeValue()
Returns the value of the node or null if the node has no value.
DOM-Level 1

setNodeValue

public void setNodeValue(var $nodeValue)
Sets the value of this node.
DOM-Level 1
Parameters:
$nodeValue - string

getOwnerDocument

public Document getOwnerDocument()
Returns a reference to the Document used to create this node.
DOM-Level 1

getParentNode

public Node getParentNode()
Returns the parent of this node.
DOM-Level 1

getPreviousSibling

public Node getPreviousSibling()
Returns the previous node in the siblings list.
DOM-Level 1

appendChild

public Node appendChild(var $newChild)
Appends the $newChild node to the end of the child list if the node is a permitted child of this node.
DOM-Level 1
Parameters:
$newChild - Node
$newChild - is passed by reference

cloneNode

public Node cloneNode(var $deep)
Returns a copy of the node without the parent node; If $deep is true, all children are also copied.
DOM-Level 1
Parameters:
$deep - boolean
$ownerDocument - Set the ownerDocument of all cloned nodes.

cloneNode

private Node cloneNode(var $deep,
                       var $ownerDocument)
Internal function for cloning a node.
Parameters:
$deep - boolean
$ownerDocument - Set the ownerDocument of all cloned nodes.
$ownerDocument - Default Value: null

hasChildNodes

public boolean hasChildNodes()
This method provides a quick way to check if a node has children.
DOM-Level 1

insertBefore

public Node insertBefore(var $newChild,
                         var $refChild)
Inserts the Node object $newChild into the child list of the parent node; The $refChild parameter allows you to specify where to insert the new node; If $refChild is null, newChild is inserted at the end of the child list; If $newChild is linked into the document tree, it is removed before it is inserted in its new position.
DOM-Level 1
Parameters:
$newChild - Node
$refChild - Node
$newChild - is passed by reference
$refChild - is passed by reference

removeChild

public Node removeChild(var $oldChild)
Unlinks the $oldChild node from the child list.
DOM-Level 1
Parameters:
$oldChild - Node

replaceChild

public Node replaceChild(var $newChild,
                         var $oldChild)
Replaces the child node $oldChild with $newChild; If $newChild is linked into the document tree, it is removed before the replace is performed.
DOM-Level 1
Parameters:
$newChild - Node
$oldChild - Node

getLocalName

public string getLocalName()
Returns the local part of the fully qualified node name.
DOM-Level 2

getNamespaceURI

public string getNamespaceURI()
Returns the namespace URI of this node.
DOM-Level 2

getPrefix

public string getPrefix()
Returns the namespace prefix of this node.
DOM-Level 2

setPrefix

public void setPrefix(var $prefix)
Changes the prefix of this node; For ELEMENT_NODE and ATTRIBUTE_NODE type nodes, changing the namespace prefix also affects the nodeName, tagName and name attributes.
DOM-Level 2
Parameters:
$prefix - string

hasAttributes

public boolean hasAttributes()
Indicates whether an Element node has any attributes.
DOM-Level 2

isSupported

public boolean isSupported(var $feature,
                           var $version)
Checks to see if a particular DOM feature is available for this implementation.
DOM-Level 2
Parameters:
$feature - string
$version - string
$version - Default Value: "1.0"

normalize

public void normalize()
Recursively combines all adjacent Text nodes into a single node; It also removes empty Text nodes from the document tree.
DOM-Level 2

checkHierarchy

private int checkHierarchy(var $child)
Checks, if the node $child is a permitted child object of the DOM hierarchy.
Parameters:
$child - Node
$child - is passed by reference

checkDocument

private int checkDocument(var $child)
Checks, if the node $child was created from the same document than this node.
Parameters:
$child - Node
$child - is passed by reference