DOM Level 2 methods are namespace aware:
public Element createElementNS(String namespaceURI, String qualifiedName)
throws DOMException
public Attr createAttributeNS(String namespaceURI, String qualifiedName)
throws DOMException
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
These set all four properties: node name, local name, namespace
URI, and prefix.
DOM Level 1 Methods are not namespace aware:
public Element createElement(String tagName) throws DOMException;
public Attr createAttribute(String name) throws DOMException;
public NodeList getElementsByTagName(String tagname);
These set the node name only. The local name, namespace
URI, and prefix are all null.
Unlike SAX, DOM does include namespace declaration attributes
such as
xmlns="http://ns.cafeconleche.org/Orders/"
and
xmlns:xlink="http://www.w3.org/1999/xlink"
in lists of attributes.
Provide a namespace URI and full prefixed name when creating elements and attributes in a namespace
Use local name and URI when searching for an element or attribute
Serialization is tricky, and not all implementations get the namespace declarations in the right place.