DocumentHelper is a collection of helper methods for using
DOM4J.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Attribute | |
| public static Attribute | |
| public static CDATA | |
| public static Comment | |
| public static Document | |
| public static Document | |
| public static Element | |
| public static Element | |
| public static Entity | |
| public static Namespace | |
| public static Pattern | Returns: a newPattern instanceis the XPath pattern expression to create xpathPattern)
|
| public static ProcessingInstruction | |
| public static ProcessingInstruction | |
| public static QName | |
| public static QName | |
| public static Text | |
| public static XPath | Returns: a newXPath instanceis the XPath expression to create xpathExpression)
|
| public static XPath | Returns: a newXPath instanceis the XPath expression to create xpathExpression, VariableContext is the variable context to use when evaluating the XPath context)
|
| public static NodeFilter | Returns: a newNodeFilter instanceis the XPath filter expression to create xpathFilterExpression)
|
| private static DocumentFactory | |
| private static String | |
| public static Element | Returns: the first Element on the given path which either already existed on the path or were created by this method.is the Element or Document to start navigating from source, String is a simple path expression, seperated by '/' which denotes
the path from the source to the resulting element such as
a/b/c path)makeElement a helper method which navigates from the given Document or Element node to some Element using the path expression, creating any necessary elements along the way. |
| public static Document | |
| public static List | Returns: the results of all the XPath evaluations as a single listis the XPath filter expression to evaluate xpathFilterExpression, List<Node> is the list of nodes on which to evalute the XPath nodes)
|
| public static List | Returns: the results of all the XPath evaluations as a single listis the XPath filter expression to evaluate xpathFilterExpression, Node is the Node on which to evalute the XPath node)
|
| public static void | sort(List<Node>
is the list of Nodes to sort list, String is the XPath expression used for comparison xpathExpression)
|
| public static void | sort(List<Node>
is the list of Nodes to sort list, String is the XPath expression used for comparison expression, boolean if true then duplicate values (using the sortXPath for
comparisions) will be removed from the List distinct)
|
| DocumentHelper | back to summary |
|---|---|
| private DocumentHelper() | |
| createAttribute | back to summary |
|---|---|
| public static Attribute createAttribute(Element owner, QName qname, String value) | |
| createAttribute | back to summary |
|---|---|
| public static Attribute createAttribute(Element owner, String name, String value) | |
| createCDATA | back to summary |
|---|---|
| public static CDATA createCDATA(String text) | |
| createComment | back to summary |
|---|---|
| public static Comment createComment(String text) | |
| createDocument | back to summary |
|---|---|
| public static Document createDocument() | |
| createDocument | back to summary |
|---|---|
| public static Document createDocument(Element rootElement) | |
| createElement | back to summary |
|---|---|
| public static Element createElement(QName qname) | |
| createElement | back to summary |
|---|---|
| public static Element createElement(String name) | |
| createEntity | back to summary |
|---|---|
| public static Entity createEntity(String name, String text) | |
| createNamespace | back to summary |
|---|---|
| public static Namespace createNamespace(String prefix, String uri) | |
| createPattern | back to summary |
|---|---|
| public static Pattern createPattern(String xpathPattern)
| |
| createProcessingInstruction | back to summary |
|---|---|
| public static ProcessingInstruction createProcessingInstruction(String pi, String d) | |
| createProcessingInstruction | back to summary |
|---|---|
| public static ProcessingInstruction createProcessingInstruction(String pi, Map<String, String> data) | |
| createQName | back to summary |
|---|---|
| public static QName createQName(String localName, Namespace namespace) | |
| createQName | back to summary |
|---|---|
| public static QName createQName(String localName) | |
| createText | back to summary |
|---|---|
| public static Text createText(String text) | |
| createXPath | back to summary |
|---|---|
| public static XPath createXPath(String xpathExpression) throws InvalidXPathException
| |
| createXPath | back to summary |
|---|---|
| public static XPath createXPath(String xpathExpression, VariableContext context) throws InvalidXPathException
| |
| createXPathFilter | back to summary |
|---|---|
| public static NodeFilter createXPathFilter(String xpathFilterExpression)
| |
| getDocumentFactory | back to summary |
|---|---|
| private static DocumentFactory getDocumentFactory() | |
| getEncoding | back to summary |
|---|---|
| private static String getEncoding(String text) | |
| makeElement | back to summary |
|---|---|
| public static Element makeElement(Branch source, String path) makeElement a helper method which navigates from the given Document or Element node to some Element using the path expression, creating any necessary elements along the way. For example the patha/b/c would
get the first child <a> element, which would be created if it did
not exist, then the next child <b> and so on until finally a
<c> element is returned.
| |
| parseText | back to summary |
|---|---|
| public static Document parseText(String text) throws DocumentException
| |
| selectNodes | back to summary |
|---|---|
| public static List
| |
| selectNodes | back to summary |
|---|---|
| public static List
| |
| sort | back to summary |
|---|---|
| public static void sort(List<Node> list, String xpathExpression)
| |
| sort | back to summary |
|---|---|
| public static void sort(List<Node> list, String expression, boolean distinct)
| |