Java XML Child Element Text getChildTextNode(Element el)

Here you can find the source of getChildTextNode(Element el)

Description

Gets the child text node containing character data for the given DOM element.

License

Open Source License

Declaration

public static Text getChildTextNode(Element el) 

Method Source Code

//package com.java2s;

import org.w3c.dom.*;

public class Main {
    /**/*from  w  ww  .ja v  a2s. c o m*/
     * Gets the child text node containing character data
     * for the given DOM element.
     */
    public static Text getChildTextNode(Element el) {
        if (el == null)
            return null;
        NodeList list = el.getChildNodes();
        int size = list.getLength();
        for (int i = 0; i < size; i++) {
            Node node = list.item(i);
            if (!(node instanceof Text))
                continue;
            return (Text) node;
        }
        return null;
    }
}

Related

  1. getChildTextByName(Element parent, String name)
  2. getChildTextByTagName(Element e, String tagName)
  3. getChildTextContent(Element elemenet, String childElemenetName)
  4. getChildTextContent(Element element, String childTagName)
  5. getChildTextList(Element elem, String childTagName)
  6. getChildTextNodes(Element parent)
  7. getChildTextNodeValue(Node node)
  8. getChildTextNodeValues(Node theNode)