Java Utililty Methods XML QName Create

List of utility methods to do XML QName Create

Description

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

Method

QNamestring2qname(String name)
stringqname
int ix = name.indexOf('@');
if (ix >= 0) {
    return new QName(name.substring(ix + 1), name.substring(0, ix));
} else {
    return new QName(name);
QNamestringToQName(String s)
string To Q Name
String[] parts = s.split(" ");
return new QName(parts[1], 
        parts[2], 
        parts[0] 
);
MaptoQName(Map setProps)
to Q Name
if (setProps == null) {
    return Collections.emptyMap();
Map<QName, String> result = new HashMap<QName, String>(setProps.size());
for (Map.Entry<String, String> entry : setProps.entrySet()) {
    result.put(createQNameWithCustomNamespace(entry.getKey()), entry.getValue());
return result;
...
QNametoQName(NamespaceContext namespaceContext, String qualifiedName)
Return the qname represented by the qualified name.
final int index = qualifiedName.indexOf(':');
if (index == -1) {
    return new QName(qualifiedName);
} else {
    String prefix = qualifiedName.substring(0, index);
    String localName = qualifiedName.substring(index + 1);
    String namespaceURI = getNormalisedValue(namespaceContext.getNamespaceURI(prefix));
    return new QName(namespaceURI, localName, prefix);
...
QNametoQName(String namespaceUri, String qualifiedName)
Convert a namespace URI and DOM or SAX qualified name to a QName.
int idx = qualifiedName.indexOf(':');
if (idx == -1) {
    return new QName(namespaceUri, qualifiedName);
} else {
    return createQName(namespaceUri, qualifiedName.substring(idx + 1), qualifiedName.substring(0, idx));
QNametoQName(String s)
Create a QName object from its stringified representation.
if (s.charAt(0) != '{') {
    throw new IllegalArgumentException("Malformed QNAME: " + s);
int idx = s.lastIndexOf('}');
if (idx == 0) {
    throw new IllegalArgumentException("Malformed QNAME: " + s);
return new QName(s.substring(1, idx), s.substring(idx + 1, s.length()));
...
QName[]toQNameArray(String[] array)
Convert an array of strings into an array of QName instances.
QName[] qnames = new QName[array.length];
for (int i = 0; i < array.length; i++) {
    qnames[i] = QName.valueOf(array[i]);
return qnames;