Save This Page
Home » dom4j-1.6.1 » org.dom4j » [javadoc | source]
org.dom4j
public final class: DocumentHelper [javadoc | source]
java.lang.Object
   org.dom4j.DocumentHelper

DocumentHelper is a collection of helper methods for using DOM4J.

Method from org.dom4j.DocumentHelper Summary:
createAttribute,   createAttribute,   createCDATA,   createComment,   createDocument,   createDocument,   createElement,   createElement,   createEntity,   createNamespace,   createPattern,   createProcessingInstruction,   createProcessingInstruction,   createQName,   createQName,   createText,   createXPath,   createXPath,   createXPathFilter,   makeElement,   parseText,   selectNodes,   selectNodes,   sort,   sort
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.dom4j.DocumentHelper Detail:
 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 Document createDocument() 
 public static Document createDocument(Element rootElement) 
 public static Element createElement(QName qname) 
 public static Element createElement(String name) 
 public static Entity createEntity(String name,
    String text) 
 public static Namespace createNamespace(String prefix,
    String uri) 
 public static Pattern createPattern(String xpathPattern) 

    createPattern parses the given XPath expression to create an XSLT style Pattern instance which can then be used in an XSLT processing model.

 public static ProcessingInstruction createProcessingInstruction(String pi,
    String d) 
 public static ProcessingInstruction createProcessingInstruction(String pi,
    Map data) 
 public static QName createQName(String localName) 
 public static QName createQName(String localName,
    Namespace namespace) 
 public static Text createText(String text) 
 public static XPath createXPath(String xpathExpression) throws InvalidXPathException 

    createXPath parses an XPath expression and creates a new XPath XPath instance using the singleton DocumentFactory .

 public static XPath createXPath(String xpathExpression,
    VariableContext context) throws InvalidXPathException 

    createXPath parses an XPath expression and creates a new XPath XPath instance using the singleton DocumentFactory .

 public 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 ]

 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 path a/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.
 public static Document parseText(String text) throws DocumentException 

    parseText parses the given text as an XML document and returns the newly created Document.

 public static List selectNodes(String xpathFilterExpression,
    List nodes) 

    selectNodes performs the given XPath expression on the List of Node instances appending all the results together into a single list.

 public static List selectNodes(String xpathFilterExpression,
    Node node) 

    selectNodes performs the given XPath expression on the List of Node instances appending all the results together into a single list.

 public static  void sort(List list,
    String xpathExpression) 
 public static  void sort(List list,
    String expression,
    boolean distinct) 

    sort sorts the given List of Nodes using an XPath expression as a java.util.Comparator and optionally removing duplicates.