Android XML Element Value Get getTextTrim(Element elto)

Here you can find the source of getTextTrim(Element elto)

Description

get Text Trim

Declaration

public static String getTextTrim(Element elto) 

Method Source Code

//package com.java2s;

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

public class Main {

    public static String getTextTrim(Element elto) {
        StringBuffer content = new StringBuffer();
        NodeList contentE = elto.getChildNodes();
        int i = 0;
        while (contentE.item(i) != null
                && (contentE.item(i).getNodeType() == Node.TEXT_NODE || contentE
                        .item(i).getNodeType() == Node.CDATA_SECTION_NODE)) {
            content.append(((Text) contentE.item(i)).getNodeValue());
            i++;/*from   www. j a v a 2s .  c om*/
        }
        return content.toString().trim();
    }
}

Related

  1. getNodeValue(Element node)
  2. getNodeValue(Element node)
  3. getText(Element parentNode)
  4. getTextNode(Element element)
  5. getTextTrim(Element elto)
  6. getValue(Element element)
  7. getValue(Element element, String elementName)
  8. getValue(Element item, String str)
  9. getStringValue(String tag, Element element)