Here you can find the source of getTexto(Node n)
Parameter | Description |
---|---|
n | a parameter |
public static String getTexto(Node n)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /**/*from w w w . ja va 2 s . c om*/ * Devuelve el texto de un nodo: <tag>TEXTO</tag> * * @param n * @return */ public static String getTexto(Node n) { NodeList nl = n.getChildNodes(); Node act = null; for (int i = 0; i < nl.getLength(); i++) { act = nl.item(i); if (act == null) return null; if ((act.getNodeType() == Node.CDATA_SECTION_NODE) || (act.getNodeType() == Node.TEXT_NODE)) return act.getNodeValue(); } return ""; } }