Package org.opencastproject.mediapackage
Class EName
java.lang.Object
org.opencastproject.mediapackage.EName
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanstatic ENamefromString(String strEName) Parse a W3C compliant string representation{namespaceURI}localname.static ENamefromString(String strEName, String defaultNameSpace) Parse a W3C compliant string representation{namespaceURI}localname.Return the local part of the name.Return the namespace name.inthashCode()booleanCheck, if this name belongs to a namespace, i.e. its namespace URI is notXMLConstants.NULL_NS_URI.static ENameCreate a new expanded name which does not belong to a namespace.static ENametoString()Return a W3C compliant string representation{namespaceURI}localname.
-
Constructor Details
-
EName
Create a new expanded name.- Parameters:
namespaceURI- the name of the namespace this EName belongs to. If set toXMLConstants.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
-
mk
Create a new expanded name which does not belong to a namespace. The namespace name is set toXMLConstants.NULL_NS_URI. -
getNamespaceURI
Return the namespace name. Usually the name will be a URI.- Returns:
- the namespace name or
XMLConstants.NULL_NS_URIif the name does not belong to a namespace
-
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 notXMLConstants.NULL_NS_URI. -
hashCode
public int hashCode() -
equals
-
toString
Return a W3C compliant string representation{namespaceURI}localname. -
compareTo
- Specified by:
compareToin interfaceComparable<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
- {namespace-only}
- contains{curly}braces
- Parameters:
strEName- AStringrepresenting anENamedefaultNameSpace- A NameSpace to apply if the providedStringdoes not have any. Please note that a explicit empty NameSpace **is** a NameSpace. If this argument is blank ornull, it has no effect.- Throws:
IllegalArgumentException
-
fromString
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
- {namespace-only}
- contains{curly}braces
- Parameters:
strEName- AStringrepresenting anEName- Throws:
IllegalArgumentException
-