Android XML Node Child Get getChildTagValue(Node node, String tag)

Here you can find the source of getChildTagValue(Node node, String tag)

Description

get Child Tag Value

Declaration

public static String getChildTagValue(Node node, String tag) 

Method Source Code

//package com.java2s;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static String getChildTagValue(Node node, String tag) {
        Element element = (Element) node;
        NodeList childrenWithTag = element.getElementsByTagName(tag)
                .item(0).getChildNodes();

        Node valueNode = (Node) childrenWithTag.item(0);

        return valueNode.getNodeValue();
    }// w  w w .j  a v  a2s . c  om
}

Related

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