Java XML Element Get Value getTextWithoutTrim(Element elem)

Here you can find the source of getTextWithoutTrim(Element elem)

Description

get Text Without Trim

License

Open Source License

Declaration

public static final String getTextWithoutTrim(Element elem) 

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 final String getTextWithoutTrim(Element elem) {
        if (elem != null) {
            NodeList childNodes = elem.getChildNodes();
            for (int i = 0; i < childNodes.getLength(); i++) {
                if (childNodes.item(i).getNodeType() == Node.TEXT_NODE) {
                    return childNodes.item(i).getNodeValue();
                }/*w  w  w  .  j  ava2 s.c  om*/
            }
        }

        return null;
    }
}

Related

  1. getTextValue(Element valueEle)
  2. getTextValue(Element valueEle)
  3. getTextValue(Element valueEle)
  4. getTextValue(final Element elem)
  5. getTextValue(final Element element, final String tagName)
  6. getTrimmedText(Element element)
  7. getTrimmedTextContent(Element element)
  8. getTrimmedTextContent(Element element)
  9. getTrimmedTextValue(Element valueEle)