public class QualifiedName extends Object
QualifiedName
is a useful class to separately capture the xml namespace prefix and local name of xml elements and attributes as a single object (instead of having to parse them out of String
s all the time). For example, the xmlName "movie:definition" has the namespace prefix "movie" and the local name "definition". If there is no namespace prefix declared, the prefix is always returned as "".Constructor and Description |
---|
QualifiedName(QualifiedName qualifiedName, String localName)
Standard Constructor (using a specified
QualifiedName for the prefix). |
QualifiedName(String xmlName)
Standard Constructor.
|
QualifiedName(String prefix, String localName)
Standard Constructor.
|
QualifiedName(XmlElement xmlElement)
Standard Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
String |
getLocalName()
Returns the local name of the
QualifiedName . |
String |
getName()
Returns the entire qualified name, including the prefix and local name.
|
String |
getPrefix()
Returns the xml prefix of the
QualifiedName . |
int |
hashCode() |
boolean |
hasPrefix()
Returns boolean based on if the
QualifiedName has a namespace prefix. |
String |
toString() |
public QualifiedName(String xmlName) throws UnknownFormatConversionException
xmlName
- The name of an xml element/attribute from which to create a qualified name. Must be of the format "prefix:name" or simply "name" (in which case the prefix is considered "")UnknownFormatConversionException
- When the specified xmlName is invalid (contains mulitple :'s)public QualifiedName(XmlElement xmlElement) throws UnknownFormatConversionException
xmlElement
- An XmlElement
from which to return the QualifiedName
UnknownFormatConversionException
- When the specified xmlElement is invalid (contains mulitple :'s)public QualifiedName(QualifiedName qualifiedName, String localName)
QualifiedName
for the prefix).qualifiedName
- The QualifiedName
on which to base the new QualifiedName
.localName
- The local name for the new QualifiedName
.public QualifiedName(String prefix, String localName)
prefix
- The xmlns prefix for the QualifiedName
localName
- The localname for the QualifiedName
public String getPrefix()
QualifiedName
.public String getLocalName()
QualifiedName
.public String getName()
public boolean hasPrefix()
QualifiedName
has a namespace prefix.true
If the QualifiedName
has an xmlns prefix