|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ozoneDB.xml.dom4j.O3DocumentHelper
O3DocumentHelper
is a collection of helper methods
for using DOM4J.
Constructor Summary | |
O3DocumentHelper()
|
Method Summary | |
static void |
configure(org.ozoneDB.OzoneInterface db)
|
static Attribute |
createAttribute(Element owner,
QName qname,
java.lang.String value)
|
static Attribute |
createAttribute(Element owner,
java.lang.String name,
java.lang.String value)
|
static CDATA |
createCDATA(java.lang.String text)
|
static Comment |
createComment(java.lang.String text)
|
static Document |
createDocument()
|
static Document |
createDocument(Element rootElement)
|
static Document |
createDocument(Element rootElement,
java.lang.String name)
creates a persistent Object with the given name |
static Document |
createDocument(java.lang.String name)
creates a persistent Object with the given name |
static Element |
createElement(QName qname)
|
static Element |
createElement(java.lang.String name)
|
static Entity |
createEntity(java.lang.String name,
java.lang.String text)
|
static Namespace |
createNamespace(java.lang.String prefix,
java.lang.String uri)
|
static Pattern |
createPattern(java.lang.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. |
static ProcessingInstruction |
createProcessingInstruction(java.lang.String target,
java.util.Map data)
|
static ProcessingInstruction |
createProcessingInstruction(java.lang.String target,
java.lang.String data)
|
static QName |
createQName(java.lang.String localName)
|
static QName |
createQName(java.lang.String localName,
Namespace namespace)
|
static Text |
createText(java.lang.String text)
|
static XPath |
createXPath(java.lang.String xpathExpression)
createXPath parses an XPath expression
and creates a new XPath XPath instance
using the singleton OzoneDocumentFactory . |
static XPath |
createXPath(java.lang.String xpathExpression,
org.jaxen.VariableContext variableContext)
createXPath parses an XPath expression
and creates a new XPath XPath instance
using the singleton OzoneDocumentFactory . |
static NodeFilter |
createXPathFilter(java.lang.String xpathFilterExpression)
createXPathFilter parses a NodeFilter
from the given XPath filter expression using the singleton
OzoneDocumentFactory .
|
static void |
deleteDocument(Document doc)
|
static Document |
fetchDocument(java.lang.String name)
|
static OzoneDocumentFactory |
getFactory()
|
static SAXReader |
getSAXReader()
Should not be used on the client side since the use will be quite slow (every sax event will result in a remote call). |
static Element |
makeElement(Branch source,
java.lang.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 |
parse(java.io.InputStream in)
Since an InputStream is not serializable we convert the content to a String This might cause memory issues on big documents |
static Document |
parse(java.io.InputStream in,
java.lang.String objectName)
Since an InputStream is not serializable we convert the content to a String This might cause memory issues on big documents |
static Document |
parse(java.io.Reader reader)
Since a Reader is not serializable we convert the content to a String This might cause memory issues on big documents |
static Document |
parse(java.io.Reader reader,
java.lang.String objectName)
Since a Reader is not serializable we convert the content to a String This might cause memory issues on big documents |
static Document |
parseRemote(java.io.InputStream in)
This will probably not work but something to this effect needs to exist in order to send the stream content through the pipe over to the server |
static Document |
parseText(java.lang.String text)
parseText parses the given text as an XML document
and returns the newly created Document. |
static Document |
parseText(java.lang.String text,
java.lang.String objectName)
|
static java.util.List |
selectNodes(java.lang.String xpathFilterExpression,
java.util.List nodes)
selectNodes performs the given XPath
expression on the List of Node instances appending
all the results together into a single list. |
static java.util.List |
selectNodes(java.lang.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. |
static void |
sort(java.util.List list,
java.lang.String xpathExpression)
sort sorts the given List of Nodes
using an XPath expression as a Comparator . |
static void |
sort(java.util.List list,
java.lang.String xpathExpression,
boolean distinct)
sort sorts the given List of Nodes
using an XPath expression as a Comparator
and optionally removing duplicates. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public O3DocumentHelper()
Method Detail |
public static void configure(org.ozoneDB.OzoneInterface db) throws java.lang.Exception
java.lang.Exception
public static OzoneDocumentFactory getFactory() throws java.lang.RuntimeException
java.lang.RuntimeException
public static Document fetchDocument(java.lang.String name)
public static void deleteDocument(Document doc)
public static Document createDocument() throws java.lang.Exception
java.lang.Exception
public static Document createDocument(Element rootElement) throws java.lang.Exception
java.lang.Exception
public static Document createDocument(java.lang.String name) throws java.lang.Exception
java.lang.Exception
public static Document createDocument(Element rootElement, java.lang.String name) throws java.lang.Exception
java.lang.Exception
public static Element createElement(QName qname) throws java.lang.Exception
java.lang.Exception
public static Element createElement(java.lang.String name) throws java.lang.Exception
java.lang.Exception
public static Attribute createAttribute(Element owner, QName qname, java.lang.String value) throws java.lang.Exception
java.lang.Exception
public static Attribute createAttribute(Element owner, java.lang.String name, java.lang.String value) throws java.lang.Exception
java.lang.Exception
public static CDATA createCDATA(java.lang.String text) throws java.lang.Exception
java.lang.Exception
public static Comment createComment(java.lang.String text) throws java.lang.Exception
java.lang.Exception
public static Text createText(java.lang.String text) throws java.lang.Exception
java.lang.Exception
public static Entity createEntity(java.lang.String name, java.lang.String text) throws java.lang.Exception
java.lang.Exception
public static Namespace createNamespace(java.lang.String prefix, java.lang.String uri) throws java.lang.Exception
java.lang.Exception
public static ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data) throws java.lang.Exception
java.lang.Exception
public static ProcessingInstruction createProcessingInstruction(java.lang.String target, java.util.Map data) throws java.lang.Exception
java.lang.Exception
public static QName createQName(java.lang.String localName, Namespace namespace) throws java.lang.Exception
java.lang.Exception
public static QName createQName(java.lang.String localName) throws java.lang.Exception
java.lang.Exception
public static XPath createXPath(java.lang.String xpathExpression) throws InvalidXPathException
createXPath
parses an XPath expression
and creates a new XPath XPath
instance
using the singleton OzoneDocumentFactory
.
xpathExpression
- is the XPath expression to create
XPath
instance
InvalidXPathException
- if the XPath expression is invalidpublic static XPath createXPath(java.lang.String xpathExpression, org.jaxen.VariableContext variableContext) throws InvalidXPathException, java.lang.Exception
createXPath
parses an XPath expression
and creates a new XPath XPath
instance
using the singleton OzoneDocumentFactory
.
xpathExpression
- is the XPath expression to createvariableContext
- is the variable context to use when evaluating the XPath
XPath
instance
InvalidXPathException
- if the XPath expression is invalid
java.lang.Exception
public static NodeFilter createXPathFilter(java.lang.String xpathFilterExpression) throws java.lang.Exception
createXPathFilter
parses a NodeFilter
from the given XPath filter expression using the singleton
OzoneDocumentFactory
.
XPath filter expressions occur within XPath expressions such as
self::node()[ filterExpression ]
xpathFilterExpression
- is the XPath filter expression
to create
NodeFilter
instance
java.lang.Exception
public static Pattern createPattern(java.lang.String xpathPattern) throws java.lang.Exception
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
Pattern
instance
java.lang.Exception
public static java.util.List selectNodes(java.lang.String xpathFilterExpression, java.util.List nodes) throws java.lang.Exception
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
java.lang.Exception
public static java.util.List selectNodes(java.lang.String xpathFilterExpression, Node node) throws java.lang.Exception
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
java.lang.Exception
public static void sort(java.util.List list, java.lang.String xpathExpression) throws java.lang.Exception
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
java.lang.Exception
public static void sort(java.util.List list, java.lang.String xpathExpression, boolean distinct) throws java.lang.Exception
sort
sorts the given List of Nodes
using an XPath expression as a Comparator
and optionally removing duplicates.
list
- is the list of Nodes to sortxpathExpression
- is the XPath expression used for comparisondistinct
- if true then duplicate values (using the sortXPath for
comparisions) will be removed from the List
java.lang.Exception
public static Document parseText(java.lang.String text) throws DocumentException
parseText
parses the given text as an XML document
and returns the newly created Document.
text
- is the XML text to be parsed
DocumentException
- if the document could not be parsedpublic static Document parseText(java.lang.String text, java.lang.String objectName) throws DocumentException
DocumentException
public static Document parse(java.io.InputStream in) throws DocumentException
in
-
DocumentException
public static Document parse(java.io.InputStream in, java.lang.String objectName) throws DocumentException
in
-
DocumentException
public static Document parse(java.io.Reader reader, java.lang.String objectName) throws DocumentException
reader
-
DocumentException
public static Document parse(java.io.Reader reader) throws DocumentException
reader
-
DocumentException
public static Document parseRemote(java.io.InputStream in) throws java.lang.Exception
in
-
java.lang.Exception
public static SAXReader getSAXReader()
public static Element makeElement(Branch source, java.lang.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 |