Android XML Node Child Get getChildText(Node n)

Here you can find the source of getChildText(Node n)

Description

get Child Text

Declaration

public static String getChildText(Node n) 

Method Source Code

//package com.java2s;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static String getChildText(Node n) {
        StringBuffer str = new StringBuffer();
        NodeList nl = n.getChildNodes();
        for (int i = 0; i < nl.getLength(); i++) {
            Node c = nl.item(i);// ww  w.  java 2  s  .co  m
            if (c.getNodeType() == Node.TEXT_NODE) {
                str.append(c.getNodeValue());
            }
        }
        return str.toString();
    }
}

Related

  1. getChildElementText(Node element, String childNodeName)
  2. getChildElements(Node node)
  3. getChildElementsByName(Element parent, String name)
  4. getChildNodes(Node node, short type)
  5. getChildTagValue(Node node, String tag)
  6. getChildren(Node node, String name)
  7. getChildren(Node node, String name)
  8. getChildren(Node node, String name)
  9. getChildrenOfName(Node node, String name)