Java tutorial
//package com.java2s; //By using the Tapjoy SDK in your software, you agree to the terms of the Tapjoy SDK License Agreement. import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /** * Helper class to help parse the server response. * * @param nodeList * @return */ public static String getNodeTrimValue(NodeList nodeList) { Element element = (Element) nodeList.item(0); String nodeValue = ""; if (element != null) { NodeList itemNodeList = element.getChildNodes(); int length = itemNodeList.getLength(); for (int i = 0; i < length; i++) { Node node = ((Node) itemNodeList.item(i)); if (node != null) nodeValue += node.getNodeValue(); } if (nodeValue != null && !nodeValue.equals("")) { return nodeValue.trim(); } else { return null; } } return null; } }