Java Utililty Methods XML QName Get

List of utility methods to do XML QName Get

Description

The list of methods to do XML QName Get are organized into topic(s).

Method

QNamegetQNameFromString(Element element, String qnameAsString)
get Q Name From String
if (qnameAsString == null || element == null) {
    return null;
int colonIndex = qnameAsString.indexOf(":");
String prefix = qnameAsString.substring(0, colonIndex);
String localName = qnameAsString.substring(colonIndex + 1);
String ns = getNamespaceURI(element, prefix);
return new QName(ns, localName, prefix);
...
QNamegetQNameFromString(Object obj)
Return a QName from the String passed in of the form {ns}element
String value;
if (obj instanceof QName) {
    return (QName) obj;
} else {
    value = obj.toString();
int open = value.indexOf('{');
int close = value.indexOf('}');
...
intgetQNameHashCode(QName aQName)
Gets the hash code of a QName.
return ("{" + aQName.getNamespaceURI() + "}" + aQName.getLocalPart()).hashCode(); 
TgetQNameType(List objects, QName qName)
get Q Name Type
for (int i = 0; i < objects.size(); i++) {
    Object o = objects.get(i);
    if (o instanceof JAXBElement) {
        JAXBElement<?> jaxbElement = (JAXBElement<?>) o;
        if (jaxbElement.getName().equals(qName)) {
            return (T) jaxbElement.getValue();
return null;
QNamegetQNameWithBackslashedLocal(QName suspectQName)
get Q Name With Backslashed Local
String trustedString = null;
trustedString = applyBackslashes(suspectQName.getLocalPart());
return getQNameWithDifferentLocal(suspectQName, trustedString);
QNamegetQNameWithDifferentLocal(QName qName, String localName)
get Q Name With Different Local
QName trustedQName = null;
trustedQName = new QName(qName.getNamespaceURI(), localName, qName.getPrefix());
return trustedQName;