| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.dom4j.DocumentHelper
 DocumentHelper is a collection of helper methods for using
 DOM4J.
 
| Method Summary | |
| static Attribute | createAttribute(Element owner,
                QName qname,
                String value) | 
| static Attribute | createAttribute(Element owner,
                String name,
                String value) | 
| static CDATA | createCDATA(String text) | 
| static Comment | createComment(String text) | 
| static Document | createDocument() | 
| static Document | createDocument(Element rootElement) | 
| static Element | createElement(QName qname) | 
| static Element | createElement(String name) | 
| static Entity | createEntity(String name,
             String text) | 
| static Namespace | createNamespace(String prefix,
                String uri) | 
| static Pattern | createPattern(String xpathPattern)createPatternparses the given XPath expression to create
 an XSLT stylePatterninstance which can then be used in an XSLT
 processing model. | 
| static ProcessingInstruction | createProcessingInstruction(String pi,
                            Map data) | 
| static ProcessingInstruction | createProcessingInstruction(String pi,
                            String d) | 
| static QName | createQName(String localName) | 
| static QName | createQName(String localName,
            Namespace namespace) | 
| static Text | createText(String text) | 
| static XPath | createXPath(String xpathExpression)createXPathparses an XPath expression and creates a new
 XPathXPathinstance using the singletonDocumentFactory. | 
| static XPath | createXPath(String xpathExpression,
            org.jaxen.VariableContext context)createXPathparses an XPath expression and creates a new
 XPathXPathinstance using the singletonDocumentFactory. | 
| static NodeFilter | createXPathFilter(String xpathFilterExpression)createXPathFilterparses a NodeFilter from the given XPath
 filter expression using the singletonDocumentFactory. | 
| 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. | 
| static Document | parseText(String text)parseTextparses the given text as an XML document and
 returns the newly created Document. | 
| static List | selectNodes(String xpathFilterExpression,
            List nodes)selectNodesperforms the given XPath expression on theListofNodeinstances appending all the results together
 into a single list. | 
| static List | selectNodes(String xpathFilterExpression,
            Node node)selectNodesperforms the given XPath expression on theListofNodeinstances appending all the results together
 into a single list. | 
| static void | sort(List list,
     String xpathExpression)sortsorts the given List of Nodes using an XPath
 expression as aComparator. | 
| static void | sort(List list,
     String expression,
     boolean distinct)sortsorts the given List of Nodes using an XPath
 expression as aComparatorand optionally removing
 duplicates. | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Method Detail | 
public static Document createDocument()
public static Document createDocument(Element rootElement)
public static Element createElement(QName qname)
public static Element createElement(String name)
public static Attribute createAttribute(Element owner,
                                        QName qname,
                                        String value)
public static Attribute createAttribute(Element owner,
                                        String name,
                                        String value)
public static CDATA createCDATA(String text)
public static Comment createComment(String text)
public static Text createText(String text)
public static Entity createEntity(String name,
                                  String text)
public static Namespace createNamespace(String prefix,
                                        String uri)
public static ProcessingInstruction createProcessingInstruction(String pi,
                                                                String d)
public static ProcessingInstruction createProcessingInstruction(String pi,
                                                                Map data)
public static QName createQName(String localName,
                                Namespace namespace)
public static QName createQName(String localName)
public static XPath createXPath(String xpathExpression)
                         throws InvalidXPathException
 createXPath parses an XPath expression and creates a new
 XPath XPath instance using the singleton DocumentFactory.
 
xpathExpression - is the XPath expression to create
XPath instance
InvalidXPathException - if the XPath expression is invalid
public static XPath createXPath(String xpathExpression,
                                org.jaxen.VariableContext context)
                         throws InvalidXPathException
 createXPath parses an XPath expression and creates a new
 XPath XPath instance using the singleton DocumentFactory.
 
xpathExpression - is the XPath expression to createcontext - is the variable context to use when evaluating the XPath
XPath instance
InvalidXPathException - if the XPath expression is invalidpublic static NodeFilter createXPathFilter(String xpathFilterExpression)
 createXPathFilter parses a NodeFilter from the given XPath
 filter expression using the singleton DocumentFactory. XPath
 filter expressions occur within XPath expressions such as
 self::node()[ filterExpression ]
 
xpathFilterExpression - is the XPath filter expression to create
NodeFilter instancepublic static Pattern createPattern(String xpathPattern)
 createPattern parses the given XPath expression to create
 an XSLT style Patterninstance which can then be used in an XSLT
 processing model.
 
xpathPattern - is the XPath pattern expression to create
Pattern instance
public static List selectNodes(String xpathFilterExpression,
                               List nodes)
 selectNodes performs the given XPath expression on the
 Listof Nodeinstances appending all the results together
 into a single list.
 
xpathFilterExpression - is the XPath filter expression to evaluatenodes - is the list of nodes on which to evalute the XPath
public static List selectNodes(String xpathFilterExpression,
                               Node node)
 selectNodes performs the given XPath expression on the
 Listof Nodeinstances appending all the results together
 into a single list.
 
xpathFilterExpression - is the XPath filter expression to evaluatenode - is the Node on which to evalute the XPath
public static void sort(List list,
                        String xpathExpression)
 sort sorts the given List of Nodes using an XPath
 expression as a Comparator.
 
list - is the list of Nodes to sortxpathExpression - is the XPath expression used for comparison
public static void sort(List list,
                        String expression,
                        boolean distinct)
 sort sorts the given List of Nodes using an XPath
 expression as a Comparatorand optionally removing
 duplicates.
 
list - is the list of Nodes to sortexpression - is the XPath expression used for comparisondistinct - if true then duplicate values (using the sortXPath for
            comparisions) will be removed from the List
public static Document parseText(String text)
                          throws DocumentException
 parseText parses the given text as an XML document and
 returns the newly created Document.
 
text - the XML text to be parsed
DocumentException - if the document could not be parsed
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.
source - is the Element or Document to start navigating frompath - is a simple path expression, seperated by '/' which denotes
            the path from the source to the resulting element such as
            a/b/c
| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||