List of utility methods to do XML QName
boolean | match(XMLStreamReader reader, QName name) match return reader.getName().equals(name);
|
boolean | matches(Node node, String requiredLocalName, QName requiredNamespace) matches if (node == null) { return false; boolean matchingNamespace = matchingNamespace(node, requiredNamespace); return matchingNamespace && matchingLocalName(node, requiredLocalName); |
boolean | matches(QName qname, Node node) matches return (node != null && qname.equals(newQName(node)));
|
boolean | matchingNamespace(Node node, QName requiredNamespace) matching Namespace if (requiredNamespace == null) { return true; } else { return requiredNamespace.getNamespaceURI().equals(node.getNamespaceURI()); |
boolean | matchNode(Node node, QName name) match Node return matchNode(node, name, false);
|
boolean | moveReaderToTag(XMLStreamReader reader, QName... tags) Moves reader to first occurrence of the structure equivalent of Xpath tags[0]/tags[1]../tags[n]. QName stopTag = reader.getName(); int currentLevel = 0; QName searchTag = tags[currentLevel]; QName parentTag = null; QName skipTag = null; for (int event = 0; reader.hasNext() && !(event == XMLStreamReader.END_ELEMENT && stopTag.equals(reader.getName())); event = reader.next()) { ... |
Predicate super Node> | namedNode(QName qname) named Node return namedNode(qname.getNamespaceURI(), qname.getLocalPart());
|
QName | nodeToQName(Node node) node To Q Name return new QName(node.getNamespaceURI(), node.getLocalName()); |
Map | parseXml(final Node node, final Map parse Xml for (int i = 0; i < node.getAttributes().getLength(); i++) { final Node item = node.getAttributes().item(i); final QName itemType = (item.getNamespaceURI() == null) ? new QName(item.getNodeName()) : new QName(item.getNamespaceURI(), item.getLocalName()); properties.put(itemType, item.getNodeValue()); for (int i = 0; i < node.getChildNodes().getLength(); i++) { final Node item = node.getChildNodes().item(i); ... |
void | printPath(List For debugging purposes only. StringBuffer buffer = new StringBuffer(); for (QName item : path) { if (buffer.toString().equals("")) buffer.append(item); else buffer.append("/" + item); |