Name

createElementNS: namespaceURI, qualifiedName(2)

Synopsis

This method serves the same purpose as the createElement method but is used when the element is in a namespace.

Arguments

namespaceURI: DOMString

The namespace URI.

qualifiedName: DOMString

The name of the element to instantiate, including the namespace prefix associated with the namespace URI given in the namespaceURI parameter.

Return values

The new Element object is returned with the following attribute values:

Attribute

Value

Node.nodeName

The complete, fully qualified name given in the qualifiedName parameter

Node.namespaceURI

The given namespace URI

Node.prefix

The namespace prefix, which is parsed from the qualifiedName parameter

Node.localName

The local part of the qualified name, located to the right of the : character

Element.tagName

The full element tag name, which is the same as the qualifiedName

Exceptions

INVALID_CHARACTER_ERR

Indicates that the name you passed to createElementNS( ) is not a legal XML name. See Chapter 2 for the XML restrictions on name construction.

NAMESPACE_ERR

Raised if the qualifiedName is malformed, has a prefix but no namespaceURI, or if the reserved xml namespace prefix was used incorrectly.

Java binding

public Element createElementNS(String namespaceURI, 
                               String qualifiedName)
                  throws DOMException;

Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.