SVG 1.2 - 27 October 2004

Appendix C: SVG DOM Subset

Table of contents


Module: dom

DOMException

IDL Definition
exception DOMException
{
	unsigned short code;
};

// ExceptionCode
const unsigned short WRONG_DOCUMENT_ERR = 4;
const unsigned short INDEX_SIZE_ERR = 1;
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
const unsigned short NOT_FOUND_ERR = 8;
const unsigned short NOT_SUPPORTED_ERR = 9;
const unsigned short INVALID_STATE_ERR = 11;
const unsigned short INVALID_MODIFICATION_ERR = 13;
const unsigned short INVALID_ACCESS_ERR = 15;
const unsigned short TYPE_MISMATCH_ERR = 17;
Constants
WRONG_DOCUMENT_ERR
If a node is used in a different document than the one that created it (that doesn't support it).
INDEX_SIZE_ERR
If index or size is negative, or greater than the allowed value.
HIERARCHY_REQUEST_ERR
If any Node is inserted somewhere it doesn't belong.
NO_MODIFICATION_ALLOWED_ERR
If an attempt is made to modify an object where modifications are not allowed.
NOT_FOUND_ERR
If an attempt is made to reference a Node in a context where it does not exist. See Node#insertBefore for example.
NOT_SUPPORTED_ERR
If the implementation does not support the requested type of object or operation.
INVALID_STATE_ERR
If an attempt is made to use an object that is not, or is no longer, usable.
INVALID_MODIFICATION_ERR
If an attempt is made to modify the type of the underlying object.
INVALID_ACCESS_ERR
If a parameter or an operation is not supported by the underlying object.
TYPE_MISMATCH_ERR
If the type of an object is incompatible with the expected type of the parameter associated to the object.
No defined attributes
No defined methods

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.

IDL Definition
interface Node
{
	readonly attribute DOMString namespaceURI;
	readonly attribute DOMString localName;
	readonly attribute Node parentNode;
	Node appendChild(in Node newChild) raises(DOMException);
	Node insertBefore(in Node newChild, in Node refChild) raises(DOMException);
	Node removeChild(in Node oldChild) raises(DOMException);
};
No defined constants
Attributes
namespaceURI
Returns the namespace URI of the Node.
localName
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.
parentNode
Returns the parent Node of this Node.
Methods
appendChild
Appends a child to this Node.

Parameters:

  • newChild the Node to be appended to this Node. This is equivalent to insertBefore(newChild,null)

Raises:

  • 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.
  • 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.
insertBefore
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.

Raises:

  • 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.
  • 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.
removeChild
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.

Raises:

  • 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.
  • DOMException with error code INVALID_ACCESS_ERR: if the element being removed or one of its decendants have non-null id.

Module: svg

SVGDocument

IDL Definition
interface SVGDocument : Document
{
	readonly attribute SVGGlobal global;
};
No defined constants
Attributes
global
Access to the SVGGlobal object.
No defined methods