org.w3c.dom
Interface Document

All Superinterfaces:
Node

public interface Document
extends Node

The Document interface represents an XML Document.

This interface is a subset of the Document interface defined in the DOM Level 3 Core.

Note the behavior of the following methods from the Node interface when called on a Document object:


Method Summary
 Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Create a new Element based on the specified (qualified) SVG tag name.
 Element getDocumentElement()
          Return a child element of this document Node which corresponds to the top-most tag in XML file.
 Element getElementById(java.lang.String id)
          Return the Element in the current document with the given unique ID.
 
Methods inherited from interface org.w3c.dom.Node
appendChild, getLocalName, getNamespaceURI, getParentNode, insertBefore, removeChild
 

Method Detail

createElementNS

Element createElementNS(java.lang.String namespaceURI,
                        java.lang.String qualifiedName)
                        throws DOMException
Create a new Element based on the specified (qualified) SVG tag name. This JSR does not require multiple namespaces and may throw a DOMException with a code of NOT_SUPPORTED_ERR if the URI is not the SVG namespace URI, or if the specified name is not a valid SVG Tiny element name. Only the following elements must be supported: <rect>, <circle>, <ellipse>, <line>, <path> <use> <image> <text>, <a> and <g>.

Parameters:
namespaceURI - the namespace uri for the newly created element. This should always be the SVG namespace URI "http://www.w3.org/2000/svg".
qualifiedName - the qualified name for the newly created element (For example: "rect", to create a <rect> element)
Returns:
the newly created SVG Element.
Throws:
DOMException - NOT_SUPPORTED_ERR if the type of element is not supported by the implementation. JSR 226 only requires creation support for some of the SVG namespace elements and only for a limited number of local names in that namespace (see above documentation). Therefore, in a conformant JSR 226 implementation, trying to create elements with a namespace URIs other than the SVG namespace URI and with a qualified name not in the list of required qualified names may result in this exception being thrown.

Note that a full DOM implementation of the JSR 226 API will throw a DOMException.INVALID_CHARACTER_ERR or a DOMException.NAMESPACE_ERR if the qualifiedName contains illegal characters or is otherwise malformed. These error codes are not supported in JSR 226, and a NOT_SUPPORTED_ERR code is thrown instead.
java.lang.NullPointerException - if namespaceURI or qualifiedName is null.

getDocumentElement

Element getDocumentElement()
Return a child element of this document Node which corresponds to the top-most tag in XML file. For SVG files it must be SVGSVGElement, but return type is Element for DOM Core compatibility and to allow for future extensions.

Returns:
the root Element associated with this document.
Throws:
java.lang.SecurityException - if the application does not have the necessary privilege rights to access this (SVG) content.

getElementById

Element getElementById(java.lang.String id)
Return the Element in the current document with the given unique ID. If no such element exists, this returns null.

Parameters:
id - the ID of the object to be retrieved.
Returns:
the Element that matches with the given ID or null if the ID is not present.
Throws:
java.lang.NullPointerException - if id 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.