List of utility methods to do XML NodeList
Map | getEnvVariableMap(NodeList nodes) get Env Variable Map Map<String, String> map = new HashMap<String, String>(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); String name = node.getAttributes().getNamedItem("name").getTextContent(); String value = node.getTextContent(); map.put(name, value); return map; ... |
Element | getFirst(NodeList nodes) get First if (nodes == null || nodes.getLength() == 0) { return null; Node node = nodes.item(0); if (node.getNodeType() != Node.ELEMENT_NODE) { return null; return (Element) node; ... |
Element | getFirstElement(NodeList list) get First Element for (int i = 0; i < list.getLength(); i++) { if (list.item(i).getNodeType() == Node.ELEMENT_NODE) return (Element) list.item(i); return null; |
Element | getFirstElement(NodeList list) get First Element return list.getLength() > 0 ? (Element) list.item(0) : null;
|
Node | getFirstElement(NodeList nodes) Returns the first node in the node list that is an element. for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { return node; return null; |
String | GetFirstInstance(NodeList nList) Get First Instance for (int i = 0; i < nList.getLength(); i++) { Node nNode = nList.item(i); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; if (eElement != null) return eElement.getTextContent(); return new String(""); |
Node | getFirstNode(NodeList nodeList) get First Node if (nodeList == null || nodeList.getLength() == 0) return null; return nodeList.item(0); |
String | getFirstNodeValue(NodeList nodeList) get First Node Value String nodeValue = ""; StringBuffer varBuffer = new StringBuffer(); Node node = (Node) nodeList.item(0); if (node != null) { NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { varBuffer.append(childNodes.item(i).getNodeValue().toString()); nodeValue = varBuffer.toString(); return nodeValue; |
String | getFirstTextValueFromNodeList(NodeList nList) Gets the first text value of a NodeList if (nList != null && nList.getLength() != 0) { return nList.item(0).getTextContent(); return null; |
String | getFirstValue(NodeList nodes) get First Value return (nodes.getLength() == 0 ? null : getValues(nodes).get(0));
|