Code example for Node

Methods: appendChildgetOwnerDocument

0
		// prevent instantiation 
	} 
 
	public static void setTextContent(Node node, String string) {
		// This would just be node.setTextContent(string) in API level >= 2.2 
		node.appendChild(node.getOwnerDocument().createTextNode(string));
	} 
 
	public static String getTextContent(Node node) {
		// This would just be node.getTextContent() in API level >= 2.2 
		StringBuffer buffer = new StringBuffer();
		NodeList childList = node.getChildNodes();
		for (int i = 0; i < childList.getLength(); i++) {
			Node child = childList.item(i);
			if (child.getNodeType() != Node.TEXT_NODE)
				continue; // skip non-text nodes 
			buffer.append(child.getNodeValue());
		} 
		return buffer.toString();
	} 
Stop searching for code, let great code find you!  Add Codota to your java IDE