List of usage examples for org.w3c.dom Node getTextContent
public String getTextContent() throws DOMException;
From source file:Main.java
private static String text(final Node node) { return node.getTextContent(); }
From source file:Main.java
public static String getString(Node node) { return node.getTextContent(); }
From source file:Main.java
public static List<String> toTextContent(List<Node> nodes) { ArrayList<String> list = new ArrayList<String>(nodes.size()); for (Node node : nodes) { list.add(node.getTextContent()); }/*w w w .j av a 2 s . c o m*/ return list; }
From source file:Main.java
static String[] getNodeValue(NodeList nodes) { String checkIds[] = new String[nodes.getLength()]; for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); checkIds[i] = node.getTextContent(); }//w w w . j av a 2 s. c o m return checkIds; }
From source file:Main.java
public static String getTag(org.w3c.dom.Element e, String index) { NodeList nList = e.getElementsByTagName(index); if (nList.getLength() != 0) { Node nNode = nList.item(0); return nNode.getTextContent(); }//from www.j a va2 s . c om return null; }
From source file:Main.java
/** * Returns normalized text content for a node. * @param node//from w w w . j a v a2 s . com * @return text content of child node, trimmed */ public static String getTextContent(Node node) { return node.getTextContent().trim(); }
From source file:Main.java
/** * Retrieves the value of a node (i.e, its text content) * //from w w w .ja v a2 s. co m * @param node * @return */ public static String getNodeValue(Node node) { return node.getTextContent(); }
From source file:Main.java
public static final String getTrimmedTextContent(Node element) { String content = element.getTextContent(); if (content == null) return null; return content.trim(); }
From source file:Main.java
/** * Returns trimmed text content of the given node * or <code>null</code> if that content is empty (is whitespace). * * @param node The node to extract content from * * @return Text content of the node/* w w w . jav a 2 s . c om*/ * * @throws NullPointerException If <code>node</code> is <code>null</code> */ public static String getBodyValue(Node node) { String text = node.getTextContent().trim(); return text.isEmpty() ? null : text; }
From source file:Main.java
/** * @param document/*w w w. ja v a2 s .c om*/ * @param name * @return */ public static String getElementByName(Document document, String name) { NodeList nodes = document.getElementsByTagName(name); String s = null; for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); s = node.getTextContent().trim(); } return s; }