List of utility methods to do XML QName Get
QName | getElementQName(Class get Element Q Name if (elementCache.containsKey(type)) return elementCache.get(type); try { Field typeField; try { typeField = type.getDeclaredField("DEFAULT_ELEMENT_NAME"); } catch (NoSuchFieldException ex) { typeField = type.getDeclaredField("ELEMENT_NAME"); ... |
QName | getElementQName(Element element) Returns the QName of the element. if (element.getPrefix() != null) { return new QName(element.getNamespaceURI(), element.getLocalName(), element.getPrefix()); } else { return new QName(element.getNamespaceURI(), element.getLocalName()); |
QName | getElementQName(Element xml) get Element Q Name String uri = xml.getNamespaceURI(); String prefix = xml.getPrefix(); String name = xml.getLocalName(); if (name == null) return new QName(xml.getNodeName()); if (prefix != null && prefix.length() > 0) return new QName(uri, name, prefix); return new QName(uri, name); ... |
QName | getElementQName(final Element el) get Element Q Name final String qualifiedName = el.getNodeName(); return resolveQName(el, qualifiedName); |
Element[] | getElements(Node context, QName qname) get Elements String name = qname.getLocalPart();
String namespace = qname.getNamespaceURI();
return getAllElements(context, namespace, name);
|
String | getName(QName qName) get Name return qName.getLocalPart() + " - " + qName.getNamespaceURI(); |
String | getName(QName qname) get Name String prefix = qname.getPrefix(); String name = qname.getLocalPart(); return (prefix != null && !"".equals(prefix)) ? prefix + ":" + name : name; |
QName | getQName(@Nonnull final Element aElement) Get the QName of the passed element. final String sNamespaceURI = aElement.getNamespaceURI(); if (sNamespaceURI == null) return new QName(aElement.getTagName()); return new QName(sNamespaceURI, aElement.getLocalName(), getPrefix(aElement)); |
QName | getQName(Class> klass) get Q Name XmlType xmlType = klass.getAnnotation(XmlType.class); if (xmlType == null) return null; String namespace = getNamespace(klass); String name = xmlType.name(); return new QName(namespace, name); |
QName | getQName(Element el) Build a QName from the element name if (el == null) { return null; } else if (el.getNamespaceURI() == null) { return new QName(el.getNodeName()); } else if (el.getPrefix() != null) { return new QName(el.getNamespaceURI(), el.getLocalName(), el.getPrefix()); } else { return new QName(el.getNamespaceURI(), el.getLocalName()); ... |