List of utility methods to do XML Element Value
String | getElementValue(Element elem, String path) Returns the text value of the named descendent. Element child = getElement(elem, path); if (child == null) return ""; String ret = ""; NodeList nl = child.getChildNodes(); for (int i = 0, len = nl.getLength(); i < len; i++) { Node node = nl.item(i); if (node.getNodeType() == Node.TEXT_NODE) ... |
String | getElementValue(Element element) get Element Value if (element != null) { NodeList nodes = element.getChildNodes(); if ((nodes != null) && (nodes.getLength() > 0)) { for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if ((node instanceof Text)) { return ((Text) node).getData(); return null; |
String | getElementValue(Element element) Returns the node value of the element's first child if there is any, otherwise null .
Node child = element.getFirstChild(); if (child != null) { return child.getNodeValue(); return null; |
String | getElementValue(Element element) Check if the element contains just a text/cdata, in which case return that value. if (element.getAttributes().getLength() > 0) { return null; NodeList children = element.getChildNodes(); String value = null; int nbrChildren = children.getLength(); for (int i = 0; i < nbrChildren; i++) { Node child = children.item(i); ... |
String | getElementValue(Element element) Get the value of the specified element NodeList nl = element.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { if (nl.item(i).getNodeType() == Node.TEXT_NODE) { return element.getFirstChild().getNodeValue(); return null; |
String | getElementValue(Element element) Gets the value of an element. if (element == null) { return null; StringBuffer sb = new StringBuffer(1000); NodeList nl = element.getChildNodes(); Node child = null; int length = nl.getLength(); for (int i = 0; i < length; i++) { ... |
String | getElementValue(Element element, String elementName) This method return role name from xml file. String roleName = ""; NodeList elementList = element.getElementsByTagName(elementName); Element ele = (Element) elementList.item(0); NodeList valueNodeList = ele.getChildNodes(); Node node = ((Node) valueNodeList.item(0)); if (node != null) { roleName = node.getNodeValue(); return roleName; |
String | getElementValue(Element element, String name) Gets the value of a named child element. return ((Element) element.getElementsByTagName(name).item(0)).getFirstChild().getNodeValue();
|
String | getElementValue(Element element, String tag) get Element Value Element by = getElement(element, tag); if (!(by == null)) { return by.getFirstChild().getNodeValue(); return null; |
String | getElementValue(Element element, String tagName) get Element Value return getElementValue(element, tagName, 0);
|