List of utility methods to do XML Node Value
String | getNodeValue(Node node) Returns the value of given node String retval = ""; try { Node firstChild = node.getFirstChild(); if (firstChild != null) retval = firstChild.getNodeValue(); } catch (Exception e) { return ""; return retval; |
String | getNodeValue(Node node, String name, boolean trim) get Node Value String retValue = null; NodeList element = ((Element) node).getElementsByTagName(name); if (element.getLength() > 0) { NodeList valueNodeList = ((Element) element.item(0)).getChildNodes(); if (valueNodeList.getLength() > 0) { retValue = valueNodeList.item(0).getNodeValue(); return (trim && (retValue != null)) ? retValue.trim() : retValue; |
String | getNodeValue(Node node, String name, String defaultVal, int index) Gets a value from a named child node NodeList nl = node.getChildNodes(); if (nl.getLength() == 0) return defaultVal; Node n = getNodeFromNodeList(nl, name, index); if (n == null) return defaultVal; n = n.getChildNodes().item(0); if (n == null) ... |
String | getNodeValue(Node node, String nodeKey) get Node Value Node opt_item = node.getAttributes().getNamedItem(nodeKey); if (opt_item != null) { Matcher nameMatcher = attrExtractor.matcher(opt_item.toString()); if (nameMatcher.find()) { return nameMatcher.group(1); return null; ... |
String | getNodeValue(Node nodeXML) Return the value of the node nodeXML return nodeXML.getChildNodes().item(0).getNodeValue();
|
String | getNodeValue(org.w3c.dom.Node node) get Node Value return node.getFirstChild().getNodeValue();
|
String | getNodeValue(org.w3c.dom.Node node) get Node Value for (int i = 0; i < node.getChildNodes().getLength(); i++) { if (node.getChildNodes().item(i).getNodeType() == Node.TEXT_NODE) return node.getChildNodes().item(i).getNodeValue(); return ""; |
Date | getNodeValueAsDate(Node node) Gets the node value as date. if (node == null) return null; NamedNodeMap attrs = node.getAttributes(); Node attr = attrs.getNamedItem("DateTimeFormat"); String format = attr.getNodeValue().trim(); node = node.getFirstChild(); if (node != null) { String date = node.getNodeValue().trim(); ... |
long | getNodeValueAsLong(Node node) Gets the node value as long. if (node != null) { node = node.getFirstChild(); if (node != null) return Long.parseLong(node.getNodeValue()); return -1; |
long | getNodeValueAsTime(Node node) Gets the node value as time. if (node == null) return -1; NamedNodeMap attrs = node.getAttributes(); Node attr = attrs.getNamedItem("Unit"); int factor = 1; String unit = attr.getNodeValue(); if (unit.equals("sec")) { factor = 1000; ... |