org.w3c.dom
Interface Node

All Known Subinterfaces:
Document, Element, SVGAnimationElement, SVGElement, SVGLocatableElement, SVGSVGElement

public interface Node

The Node interface describes generic nodes in an SVG document tree. This interface is a subset of the Node interface defined in the DOM Level 3 Core.

Note: The methods defined in this interface allow DOM manipulation such as removal and insertion which may lead to the creation of a non-conforming SVG document fragment as described in the SVG1.1 specification, section G2. The rendering of these fragments may be handled differently by different SVG engine implementations, and therefore, it is strongly recommended that any application using this interface ensures that the resulting document is SVG-conformant. An example of non-conforming SVG fragment would be a rectangle inserted as a child of an other rectangle or as a child of an animation.


Method Summary
 Node appendChild(Node newChild)
          Appends a child to this Node.
 java.lang.String getLocalName()
          Returns the local part of the qualified name of this node.
 java.lang.String getNamespaceURI()
          Returns the namespace URI of the Node.
 Node getParentNode()
          Returns the parent Node of this Node.
 Node insertBefore(Node newChild, Node refChild)
          Inserts newChild before refChild in the child list for this node.
 Node removeChild(Node oldChild)
          Removes the specified child associated with this Node.
 

Method Detail

getNamespaceURI

java.lang.String getNamespaceURI()
Returns the namespace URI of the Node.

Returns:
the namespace URI of the Node.
Throws:
java.lang.SecurityException - if the application does not have the necessary privilege rights to access this (SVG) content.

getLocalName

java.lang.String getLocalName()
Returns the local part of the qualified name of this node. If the node is of type SVGElement, this returns the tag name without a prefix. But, if the node is of type Document then null is returned.

Returns:
the local part of the qualified name of this node.
Throws:
java.lang.SecurityException - if the application does not have the necessary privilege rights to access this (SVG) content.

getParentNode

Node getParentNode()
Returns the parent Node of this Node.

Returns:
the parent node or null if there is no parent (i.e. if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is null).
Throws:
java.lang.SecurityException - if the application does not have the necessary privilege rights to access this (SVG) content.

appendChild

Node appendChild(Node newChild)
                 throws DOMException
Appends a child to this Node.

Parameters:
newChild - the Node to be appended to this Node. This is equivalent to insertBefore(newChild,null)
Returns:
the added Node.
Throws:
DOMException - with error code HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to append a second Element node.
DOMException - with error code WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
DOMException - with error code NOT_SUPPORTED_ERR: if the newChild node is a child of the Document node or if the child is of a type that cannot be created with createElementNS.
DOMException - with error code INVALID_STATE_ERR: if the newChild node would cause the document to go into error, for ex: when the newChild contains a <use> element with an invalid xlink:href attribute.
DOMException - with error code INVALID_ACCESS_ERR: if the element being appended to the tree already has a parent and itself or one of its descendants has a non-null id.
java.lang.NullPointerException - if newChild is null.
java.lang.SecurityException - if the application does not have the necessary privilege rights to access this (SVG) content.

removeChild

Node removeChild(Node oldChild)
                 throws DOMException
Removes the specified child associated with this Node. Elements that have ids cannot be removed from the tree.

Parameters:
oldChild - the Node that is to be removed.
Returns:
the node removed.
Throws:
DOMException - with error code NOT_FOUND_ERR: Raised if oldChild is not a child of this node.
DOMException - with error code NOT_SUPPORTED_ERR: if this node is of type Document or if the child, or any of its descendants, is of a type that cannot be created with createElementNS.
DOMException - with error code INVALID_ACCESS_ERR: if the element being removed or one of its decendants have non-null id.
java.lang.NullPointerException - if oldChild is null.
java.lang.SecurityException - if the application does not have the necessary privilege rights to access this (SVG) content.

insertBefore

Node insertBefore(Node newChild,
                  Node refChild)
                  throws DOMException
Inserts newChild before refChild in the child list for this node. If refChild is null, newChild is inserted at the end of the list. If the newChild is already part of the tree, it is first removed.

Parameters:
newChild - the child to add
refChild - the child before which the new child should be added.
Returns:
the node being inserted.
Throws:
DOMException - with error code HIERARCHY_REQUEST_ERR: if this node is of a type that does not allow children of the type of the newChild node, or if the node to append is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to append a second Element node.
DOMException - with error code WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
DOMException - with error code NOT_FOUND_ERR: raised if refChild is not a child of this node.
DOMException - with error code NOT_SUPPORTED_ERR: if the newChild node is a child of the Document node or if the child is of a type that cannot be created with createElementNS.
DOMException - with error code INVALID_STATE_ERR: if the newChild node would cause the document to go into error, for ex: when the newChild contains a <use> element with an invalid xlink:href attribute.
DOMException - with error code INVALID_ACCESS_ERR: if the element being inserted into the tree already has a parent and itself or one of its descendants has a non-null id.
java.lang.NullPointerException - if newChild is null.
java.lang.SecurityException - if the application does not have the necessary privilege rights to access this (SVG) content.


Copyright © 2003-2006 Nokia Corporation. See the Copyright Notice for details.