createAttribute
public static Attribute createAttribute(Element owner,
String name,
String value)
createCDATA
public static CDATA createCDATA(String text)
createComment
public static Comment createComment(String text)
createDocument
public static Document createDocument()
createElement
public static Element createElement(String name)
createElement
public static Element createElement(QName qname)
createEntity
public static Entity createEntity(String name,
String text)
createNamespace
public static Namespace createNamespace(String prefix,
String uri)
createPattern
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.
xpathPattern
- is the XPath pattern expression to create
createProcessingInstruction
public static ProcessingInstruction createProcessingInstruction(String pi,
Map data)
createProcessingInstruction
public static ProcessingInstruction createProcessingInstruction(String pi,
String d)
createQName
public static QName createQName(String localName)
createQName
public static QName createQName(String localName,
Namespace namespace)
createText
public static Text createText(String text)
createXPath
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
createXPath
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
.
xpathExpression
- is the XPath expression to createcontext
- is the variable context to use when evaluating the XPath
createXPathFilter
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 ]
xpathFilterExpression
- is the XPath filter expression to create
- a new
NodeFilter
instance
makeElement
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.
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
- the first Element on the given path which either already existed
on the path or were created by this method.
parseText
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
selectNodes
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.
xpathFilterExpression
- is the XPath filter expression to evaluatenodes
- is the list of nodes on which to evalute the XPath
- the results of all the XPath evaluations as a single list
selectNodes
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.
xpathFilterExpression
- is the XPath filter expression to evaluatenode
- is the Node on which to evalute the XPath
- the results of all the XPath evaluations as a single list
sort
public static void sort(List list,
String xpathExpression)
sort
sorts the given List of Nodes using an XPath
expression as a java.util.Comparator
.
list
- is the list of Nodes to sortxpathExpression
- is the XPath expression used for comparison
sort
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.
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