Class Namespaces


  • public class Namespaces
    extends java.lang.Object
    Static Namespace query methods.

    This class defines a set of static methods that can be called to analyze the namespace properties of DOM nodes.

    Version:
    1.0
    Author:
    Norman Walsh Norman.Walsh@Sun.COM
    • Constructor Summary

      Constructors 
      Constructor Description
      Namespaces()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getLocalName​(org.w3c.dom.Element element)
      Returns the "localname" part of a QName, which is the whole name if it has no prefix.
      static java.lang.String getNamespaceURI​(org.w3c.dom.Element element)
      Returns the namespace URI for the namespace to which the element belongs.
      static java.lang.String getNamespaceURI​(org.w3c.dom.Node node, java.lang.String prefix)
      Returns the namespace URI for the specified prefix at the specified context node.
      static java.lang.String getPrefix​(org.w3c.dom.Element element)
      Returns the "prefix" part of a QName or the empty string (not null) if the name has no prefix.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Namespaces

        public Namespaces()
    • Method Detail

      • getPrefix

        public static java.lang.String getPrefix​(org.w3c.dom.Element element)
        Returns the "prefix" part of a QName or the empty string (not null) if the name has no prefix.
        Parameters:
        element - The QName of an element.
        Returns:
        The prefix part of the element name.
      • getLocalName

        public static java.lang.String getLocalName​(org.w3c.dom.Element element)
        Returns the "localname" part of a QName, which is the whole name if it has no prefix.
        Parameters:
        element - The QName of an element.
        Returns:
        The local part of a QName.
      • getNamespaceURI

        public static java.lang.String getNamespaceURI​(org.w3c.dom.Node node,
                                                       java.lang.String prefix)
        Returns the namespace URI for the specified prefix at the specified context node.
        Parameters:
        node - The context node.
        prefix - The prefix.
        Returns:
        The namespace URI associated with the prefix, or null if no namespace declaration exists for the prefix.
      • getNamespaceURI

        public static java.lang.String getNamespaceURI​(org.w3c.dom.Element element)
        Returns the namespace URI for the namespace to which the element belongs.
        Parameters:
        element - The element.
        Returns:
        The namespace URI associated with the namespace of the element, or null if no namespace declaration exists for it.