List of utility methods to do XML Node Value Get
boolean | GetBooleanValue(Node item) Get Boolean Value String asString = GetStringValue(item); if (asString.compareTo("0") == 0 || asString.compareToIgnoreCase("false") == 0) return false; else if (asString.compareTo("1") == 0 || asString.compareToIgnoreCase("true") == 0) return true; else ... |
int | GetInt32Value(Node item) Get Int Value String asString = GetStringValue(item);
return Integer.parseInt(asString);
|
String | GetStringValue(Node item) Get String Value if (item instanceof Element) { Node node = item.getFirstChild(); if (node != null) return node.getNodeValue(); else return ""; } else throw new Exception(String.format("Cannot handle '%s'.", ... |
double | getDoubleNodeValue(Node node) get Double Node Value return Double.parseDouble(getTextNodeValue(node));
|
String | getElementValue(Node aElem) Gets item value Node child; if (aElem != null) { if (aElem.hasChildNodes()) { for (child = aElem.getFirstChild(); child != null; child = child .getNextSibling()) { if (child.getNodeType() == Node.TEXT_NODE) { return child.getNodeValue(); return ""; |
String | getElementValue(Node elem) get Element Value Node kid; if (elem != null) { if (elem.hasChildNodes()) { for (kid = elem.getFirstChild(); kid != null; kid = kid .getNextSibling()) { if (kid.getNodeType() == Node.TEXT_NODE) { return kid.getNodeValue(); return ""; |
String | getElementValue(Node elem) get Element Value Node child; if (elem != null) { if (elem.hasChildNodes()) { for (child = elem.getFirstChild(); child != null; child = child .getNextSibling()) { if (child.getNodeType() == Node.TEXT_NODE) { return child.getNodeValue(); return ""; |
Element | getNextElement(Node el) get Next Element while ((el != null) && (el.getNodeType() != Node.ELEMENT_NODE)) { el = el.getNextSibling(); return (Element) el; |
String | getNodeValue(Node node) get Node Value return (node == null || node.getFirstChild() == null || node
.getFirstChild().getNodeValue() == null) ? null : node
.getFirstChild().getNodeValue().trim();
|
String | getText(Node n) get Text if (n != null) { Node text = n.getFirstChild(); if (text != null) { String s = text.getNodeValue(); return s.trim(); return ""; ... |