List of usage examples for org.dom4j Element node
Node node(int index) throws IndexOutOfBoundsException;
Node
at the specified index position. From source file:com.doculibre.constellio.wicket.components.ConnectorInstanceConfigFormSnippet.java
License:Open Source License
public void setInvalidFormSnippetElement(Element formSnippetElement) { if (formSnippetElement != null) { CDATA cdata = (CDATA) formSnippetElement.node(0); String configFormSnippetText = cdata.getStringValue(); this.configFormSnippetTextModel = new Model(configFormSnippetText); }/* www.j a v a2s. c om*/ }
From source file:com.flaptor.hounder.util.HtmlParser.java
License:Apache License
/** * Simple method to concatenate all readable text in the document and get the outlinks. * /*from w ww .j av a 2s.c o m*/ * @param e * the element in where to look for readable text and outlinks. * @param out * the parse output so far. For any caller except the getText itself, * should be empty. After return, it contains the readable text * of the html and the outlinks. */ protected void extractText(final Element e, final Output out, final String fieldName) { //String nodeName = e.getName(); if (!(e.getNodeType() == Node.COMMENT_NODE)) { int size = e.nodeCount(); for (int i = 0; i < size; i++) { Node node = e.node(i); if (node instanceof Element) { extractText((Element) node, out, fieldName); } else if (node instanceof Text) { String t = node.getText(); out.addFieldString(fieldName, t); } } } }
From source file:com.flaptor.util.DomUtil.java
License:Apache License
/** * Gets the entire text of an element an all its children * // ww w . j av a 2 s . c o m * @param element * @return */ public static String getElementTextRecursively(final Element element) { String result = ""; if (!(element.getNodeType() == Node.COMMENT_NODE)) { int size = element.nodeCount(); for (int i = 0; i < size; i++) { Node node = element.node(i); if (node instanceof Element) { result += getElementTextRecursively((Element) node); } else if (node instanceof Text) { result += node.getText(); } } } return result; }
From source file:com.flaptor.util.parser.HtmlParser.java
License:Apache License
/** * Simple method to concatenate all readable text in the document and get the outlinks. * //from w w w .j ava2 s . c o m * @param e * the element in where to look for readable text and outlinks. * @param out * the parse output so far. For any caller except the getText itself, * should be empty. After return, it contains the readable text * of the html and the outlinks. */ protected void extractAllText(final Element e, final ParseOutput out, final String fieldName) { //String nodeName = e.getName(); if (!(e.getNodeType() == Node.COMMENT_NODE)) { int size = e.nodeCount(); for (int i = 0; i < size; i++) { Node node = e.node(i); if (node instanceof Element) { extractAllText((Element) node, out, fieldName); } else if (node instanceof Text) { String t = node.getText(); out.addFieldString(fieldName, t); } } } }
From source file:com.globalsight.everest.edit.offline.page.TmxUtil.java
License:Apache License
public static void findNbspElements(ArrayList p_result, Element p_element) { // Depth-first traversal: add embedded <ph x-nbspace> to the list first. for (int i = 0, max = p_element.nodeCount(); i < max; i++) { Node child = (Node) p_element.node(i); if (child instanceof Element) { findNbspElements(p_result, (Element) child); }//w w w .j a v a 2 s . c om } if (p_element.getName().equals("ph")) { String attr = p_element.attributeValue("type"); if (attr != null && attr.equals("x-nbspace")) { p_result.add(p_element); } } }
From source file:com.globalsight.everest.edit.offline.page.TmxUtil.java
License:Apache License
public static void findSubElements(ArrayList p_result, Element p_element) { // Depth-first traversal: add embedded <sub> to the list first. for (int i = 0, max = p_element.nodeCount(); i < max; i++) { Node child = (Node) p_element.node(i); if (child instanceof Element) { findSubElements(p_result, (Element) child); }//w w w. j a v a 2s . c o m } if (p_element.getName().equals("sub")) { p_result.add(p_element); } }
From source file:com.globalsight.everest.edit.offline.page.TmxUtil.java
License:Apache License
private static void findHiElements(ArrayList p_result, Element p_element) { // Depth-first traversal: add embedded <hi> to the list first. for (int i = 0, max = p_element.nodeCount(); i < max; i++) { Node child = (Node) p_element.node(i); if (child instanceof Element) { findHiElements(p_result, (Element) child); }/*from ww w .j a v a2s .c o m*/ } if (p_element.getName().equals("hi")) { p_result.add(p_element); } }
From source file:com.globalsight.everest.projecthandler.ProjectTmTuvT.java
License:Apache License
private void findHiElements(ArrayList p_result, Element p_element) { // Depth-first traversal: add embedded <hi> to the list first. for (int i = 0, max = p_element.nodeCount(); i < max; i++) { Node child = (Node) p_element.node(i); if (child instanceof Element) { findHiElements(p_result, (Element) child); }// w w w . j a va2 s .c o m } if (p_element.getName().equals("hi")) { p_result.add(p_element); } }
From source file:com.globalsight.everest.tm.exporter.TmxWriter.java
License:Apache License
private static void findSubElements(ArrayList p_result, Element p_element) { // Depth-first traversal: add embedded <sub> to the list first. for (int i = 0, max = p_element.nodeCount(); i < max; i++) { Node child = (Node) p_element.node(i); if (child instanceof Element) { findSubElements(p_result, (Element) child); }/*from ww w. j a v a 2 s .c om*/ } if (p_element.getName().equals("sub")) { p_result.add(p_element); } }
From source file:com.globalsight.everest.tm.exporter.TmxWriter.java
License:Apache License
private static void findNbspElements(ArrayList p_result, Element p_element) { // Depth-first traversal: add embedded <ph x-nbspace> to the list first. for (int i = 0, max = p_element.nodeCount(); i < max; i++) { Node child = (Node) p_element.node(i); if (child instanceof Element) { findNbspElements(p_result, (Element) child); }/* ww w .j a va 2 s. co m*/ } if (p_element.getName().equals("ph")) { String attr = p_element.attributeValue("type"); if (attr != null && attr.equals("x-nbspace")) { p_result.add(p_element); } } }