Java XML Element Get Value getValue(Element element)

Here you can find the source of getValue(Element element)

Description

get Value

License

Open Source License

Declaration

public static String getValue(Element element) 

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 getValue(Element element) {
        NodeList l = element.getChildNodes();
        StringBuffer s = new StringBuffer();
        for (int i = 0; i < l.getLength(); i++) {
            switch (l.item(i).getNodeType()) {
            case Node.TEXT_NODE:
            case Node.CDATA_SECTION_NODE:
                s.append(l.item(i).getNodeValue());
            }/*  w  w w .j a  v  a  2 s  .  c  om*/
        }
        return s.toString();
    }
}

Related

  1. getUniqueSubnode(Element rootNode, String name)
  2. getValue(Element e, String tagName)
  3. getValue(Element el)
  4. getValue(Element element)
  5. getValue(Element element)
  6. getValue(Element element, String tag)
  7. getValue(Element pElement)
  8. getValueFromElement(Element element, String tagName)
  9. getValueFromElement(Element element, String tagName)