Class Namespace


  • public class Namespace
    extends Object
    Data structure for representing XML namespace attributes.
    • Field Detail

      • namespaceURI

        private String namespaceURI
        URI of the namespace.
      • namespacePrefix

        private String namespacePrefix
        Prefix of the namespace.
      • nsStr

        private String nsStr
        String representation of this namespace.
    • Constructor Detail

      • Namespace

        public Namespace​(@Nullable
                         String uri,
                         @Nullable
                         String prefix)
        Constructor.
        Parameters:
        uri - the URI of the namespace
        prefix - the prefix of the namespace
    • Method Detail

      • getNamespacePrefix

        public String getNamespacePrefix()
        Gets the prefix of the namespace.
        Returns:
        the prefix of the namespace, may be null if this is a default namespace
      • getNamespaceURI

        public String getNamespaceURI()
        Gets the URI of the namespace.
        Returns:
        the URI of the namespace
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object obj)
        Checks if the given object is the same as this Namespace. This is true if:
        • The given object is of type Namespace
        • The given object's namespace URI is the same as this object's namespace URI
        • The given object's namespace prefix is the same as this object's namespace prefix
        Overrides:
        equals in class Object
        Parameters:
        obj -
        Returns:
      • constructStringRepresentation

        protected void constructStringRepresentation()
        Constructs an XML namespace declaration string representing this namespace.