com.sun.xml.tree
Interface NamespaceScoped

All Known Subinterfaces:
ElementEx

public abstract interface NamespaceScoped
extends NodeEx

This interface is supported by elements and attributes whose names are scoped according to the XML Namespaces specification.


Fields inherited from class org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Method Summary
 java.lang.String getLocalName()
          Returns the "local part" of the object's scoped name, without any namespace prefix.
 java.lang.String getNamespace()
          Return the XML namespace name (a URI) associated with this object, or null for the case of the default document namespace.
 java.lang.String getPrefix()
          Returns any prefix of the object's name.
 void setPrefix(java.lang.String prefix)
          Assigns a prefix to be used for the object's name.
 
Methods inherited from interface com.sun.xml.tree.NodeEx
getIndexOf, getInheritedAttribute, getInheritedAttribute, getLanguage, isReadonly, setReadonly
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPreviousSibling, hasChildNodes, insertBefore, removeChild, replaceChild, setNodeValue
 
Methods inherited from interface com.sun.xml.tree.XmlWritable
writeChildrenXml, writeXml
 

Method Detail

getLocalName

public java.lang.String getLocalName()
Returns the "local part" of the object's scoped name, without any namespace prefix.

getNamespace

public java.lang.String getNamespace()
Return the XML namespace name (a URI) associated with this object, or null for the case of the default document namespace. This is computed from this node and its ancestors.
Throws:
IllegalStateException - Thrown when the namespace prefix for this element is not known.

getPrefix

public java.lang.String getPrefix()
Returns any prefix of the object's name. This is only a context-sensitive alias for the namespace URI. If the name is unqualified (e.g. template vs xsl:template), the null string is returned.

The URI corresponding to that prefix may be retrieved by getting the inherited value of the attribute named "xmlns:" + getPrefix () if the prefix is not null; if there is no value for this URI, that indicates an error. If the prefix is null, the URI is the inherited value of the attribute named "xmlns"; if there is no value for that URI, the default namespace has not been defined.

See Also:
setPrefix(java.lang.String)

setPrefix

public void setPrefix(java.lang.String prefix)
Assigns a prefix to be used for the object's name. This method should be used with care, primarily to "patch up" elements after they have been moved to a context where the correct namespace may call for a different prefix. This method does not check whether the prefix is declared. The return value of getNodeName may change, if this prefix was not the one being used.

To assign the URI associated with this prefix, declare the prefix by defining a value for the "xmlns" + prefix attribute for this node's element or an ancestor element. For the null prefix, give a value for the "xmlns" attribute instead. All non-null prefixes must be declared.

Parameters:
prefix - null to remove any prefix, otherwise the unqualified name prefix to be be used.
See Also:
getPrefix()


Submit Feedback to xml-feedback@java.sun.com