Class Namespace

    • Constructor Detail

      • Namespace

        public Namespace​(String uri,
                         String prefix)
        Creates a Namespace instance.
        Parameters:
        uri - the namespace URI.
        prefix - the namespace preferred prefix.
    • Method Detail

      • parseQName

        public static QName parseQName​(String uri)
        Splits a URI into a qualified name (namespace + localpart).
        Parameters:
        uri - the URI to parse.
        Returns:
        the corresponding QName.
        Throws:
        IllegalArgumentException - if the URI is not a namespace URI.
        Since:
        3.1.0
      • getUri

        public String getUri()
        Returns the namespace URI.
        Returns:
        the namespace URI.
      • getPrefix

        public String getPrefix()
        Returns the namespace preferred prefix.
        Returns:
        the namespace preferred prefix.
      • getQName

        public QName getQName​(String uri)
        Returns the qualified name of the URI, which is this namespace URI concatenated with the local part of the specified URI.
        Parameters:
        uri - either a simple name (e.g "title"), a full name (e.g. "http://purl.org/dc/terms/title") or a prefixed name (e.g. "dcterms:title")
        Returns:
        the qualified name of the namespace, which is the namespace URI concatenated with the specified local part.
      • getPrefixed

        public String getPrefixed​(String uri)
        Returns the prefixed name of the specified URI, which is the preferred namespace prefix (as defined on this instance) and the local part of the URI. As an example, this method returns "dcterms:title" for a "http://purl.org/dc/terms/title" URI.
        Parameters:
        uri - either a simple name (e.g "title"), a full name (e.g. "http://purl.org/dc/terms/title") or a prefixed name (e.g. "dcterms:title")
        Returns:
        the prefix name of the URI.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object