Class EName

java.lang.Object
org.opencastproject.mediapackage.EName
All Implemented Interfaces:
Serializable, Comparable<EName>

public final class EName extends Object implements Serializable, Comparable<EName>
An XML Expanded Name, cf. W3C definition.

Expanded names in XML consists of a namespace name (URI) and a local part. In opposite to Qualified Names, cf. W3C definition - which are made from an optional prefix and the local part - expanded names are not subject to namespace interpretation.

Please see http://www.w3.org/TR/xml-names/ for a complete definition and reference.

See Also:
  • Constructor Details

    • EName

      public EName(String namespaceURI, String localName)
      Create a new expanded name.
      Parameters:
      namespaceURI - the name of the namespace this EName belongs to. If set to XMLConstants.NULL_NS_URI, this name does not belong to any namespace. Use this option with care.
      localName - the local part of the name. Must not be empty.
  • Method Details

    • mk

      public static EName mk(String namespaceURI, String localName)
    • mk

      public static EName mk(String localName)
      Create a new expanded name which does not belong to a namespace. The namespace name is set to XMLConstants.NULL_NS_URI.
    • getNamespaceURI

      public String getNamespaceURI()
      Return the namespace name. Usually the name will be a URI.
      Returns:
      the namespace name or XMLConstants.NULL_NS_URI if the name does not belong to a namespace
    • getLocalName

      public String getLocalName()
      Return the local part of the name.
    • hasNamespace

      public boolean hasNamespace()
      Check, if this name belongs to a namespace, i.e. its namespace URI is not XMLConstants.NULL_NS_URI.
    • hashCode

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

      public boolean equals(Object that)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Return a W3C compliant string representation {namespaceURI}localname.
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(EName o)
      Specified by:
      compareTo in interface Comparable<EName>
    • fromString

      public static EName fromString(String strEName, String defaultNameSpace) throws IllegalArgumentException
      Parse a W3C compliant string representation {namespaceURI}localname. A String representing an EName may start with a namespace among curly braces ("{" and "}") and then it must contain a local name *without* any blank characters or curly braces. This is a superset of the character restrictions defined by the XML standard, where neither namespaces nor local names may contain curly braces or spaces. Examples:
      • {http://my-namespace}mylocalname
      • {}localname-with-explicit-empty-namespace
      • localname-without-namespace
      Incorrect examples:
      • {namespace-only}
      • contains{curly}braces
      Parameters:
      strEName - A String representing an EName
      defaultNameSpace - A NameSpace to apply if the provided String does not have any. Please note that a explicit empty NameSpace **is** a NameSpace. If this argument is blank or null, it has no effect.
      Throws:
      IllegalArgumentException
    • fromString

      public static EName fromString(String strEName) throws IllegalArgumentException
      Parse a W3C compliant string representation {namespaceURI}localname. A String representing an EName may start with a namespace among curly braces ("{" and "}") and then it must contain a local name *without* any curly braces. This is a superset of the character restrictions defined by the XML standard, where neither namespaces nor local names may contain curly braces. Examples:
      • {http://my-namespace}mylocalname
      • localname-without-namespace
      Incorrect examples:
      • {namespace-only}
      • contains{curly}braces
      Parameters:
      strEName - A String representing an EName
      Throws:
      IllegalArgumentException