Top Constructors Methods
com.openhtmltopdf.pdfboxout

public Class DOMUtil

extends Object
Class Inheritance
Imports
java.util.ArrayList, .List, org.w3c.dom.Element, .Node, .NodeList

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Element
findClosestEnclosingElementWithNodeName(Node e, String nodeName)

Helper function to find an enclosing element with given node name.

public static Element
getChild(Element parent, String name)

public static List<Element>
getChildren(Element parent, String name)

public static String

Returns:

a String with the text content of an element (may be an empty string but will not be null).
getText
(Element parent)

Loads all of the text content in all offspring of an element.

public static void
getText(Element parent, StringBuilder
will get the text content of the element children
sb
)

Appends all text content in all offspring of an element to a StringBuffer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DOMUtilback to summary
public DOMUtil()

Method Detail

findClosestEnclosingElementWithNodeNameback to summary
public static Element findClosestEnclosingElementWithNodeName(Node e, String nodeName)

Helper function to find an enclosing element with given node name. Returns null on failure.

getChildback to summary
public static Element getChild(Element parent, String name)
getChildrenback to summary
public static List<Element> getChildren(Element parent, String name)
getTextback to summary
public static String getText(Element parent)

Loads all of the text content in all offspring of an element. Ignores all attributes, comments and processing instructions.

Returns:String

a String with the text content of an element (may be an empty string but will not be null).

getTextback to summary
public static void getText(Element parent, StringBuilder sb)

Appends all text content in all offspring of an element to a StringBuffer. Ignores all attributes, comments and processing instructions.

Parameters
sb:StringBuilder

will get the text content of the element children