Java Utililty Methods XML QName

List of utility methods to do XML QName

Description

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

Method

QNamestringToQName(XMLStreamReader reader, String text, String defaultNS)
string To Q Name
String localPart = text.substring(text.indexOf(':') + 1, text.length());
int i = text.indexOf(':');
String prefix = i < 0 ? null : text.substring(0, i);
String namespaceURI = prefix == null ? defaultNS : reader.getNamespaceURI(prefix);
return prefix == null ? new QName(namespaceURI, localPart) : new QName(namespaceURI, localPart, prefix);
StringtoJavaName(QName xmlName)
Translate an XML name to a Java name.
return xmlName.getLocalPart();
QNameuniqueQName(QName q)
unique Q Name
String s = q.getNamespaceURI();
while (s.endsWith("/")) {
    s = s.substring(0, s.length() - 1);
return new QName(s, q.getLocalPart());
QNameuriToQName(String uri)
uri To Q Name
if (uri == null) {
    throw new IllegalArgumentException("URI is null");
int index = uri.lastIndexOf("#");
if (index != -1) {
    String ns = uri.substring(0, index);
    String name = uri.substring(index + 1);
    return new QName(ns, name);
...