List of utility methods to do XML Node Text Value
String | getString(Node node) get String return node.getTextContent();
|
String | getStringValue(NamedNodeMap values, String name) get String Value return getStringValue(values, name, null);
|
String | getStringValue(Node node) Return the String value of a Node. String value = node.getNodeValue(); if (node.hasChildNodes()) { Node first = node.getFirstChild(); if (first.getNodeType() == Node.TEXT_NODE) { return first.getNodeValue(); return value; ... |
String | getStringValue(Node node) Return the String value of a Node. String value = node.getNodeValue(); if (node.hasChildNodes()) { Node first = node.getFirstChild(); if (first.getNodeType() == Node.TEXT_NODE) { return first.getNodeValue(); return value; ... |
String | getTagValue(Node node, String name) get Tag Value if (node.getNodeType() == Node.ELEMENT_NODE) { Element el = (Element) node; NodeList nodeList = el.getElementsByTagName(name); if (nodeList.getLength() > 0) { el = (Element) nodeList.item(0); nodeList = el.getChildNodes(); if (nodeList.getLength() > 0) { return ((Node) nodeList.item(0)).getNodeValue(); ... |
String | getTagValueWithoutNamespace(Node n) Gets the tag value without namespace. if (n != null) { String tag = n.getNodeName(); return tag.substring(tag.indexOf(":") + 1, tag.length()); return null; |
String | getText(final Node node) get Text StringBuilder sb = new StringBuilder(); getText(node, sb); return sb.toString(); |
String | getText(final Node xmlNode) Retrieves contents of first Text Node defined within an XML Node return xmlNode == null ? null : xmlFindTextNode(xmlNode);
|
String | getText(Node elem) get Text if (elem.getNodeType() == Element.TEXT_NODE) return elem.getTextContent(); else if (elem.hasChildNodes()) return elem.getFirstChild().getTextContent(); return ""; |
String | getText(Node elem, StringBuilder buffer) get Text if (elem.getNodeType() != Node.CDATA_SECTION_NODE) { NodeList childs = elem.getChildNodes(); for (int i = 0; i < childs.getLength(); i++) { Node child = childs.item(i); short childType = child.getNodeType(); if (childType != Node.COMMENT_NODE && childType != Node.PROCESSING_INSTRUCTION_NODE) { getText(child, buffer); } else { buffer.append(elem.getNodeValue()); return buffer.toString(); |