public class DocumentFactory
extends java.lang.Object
implements java.io.Serializable
DocumentFactory
is a collection of factory methods to allow
easy custom building of DOM4J trees. The default tree that is built uses a
doubly linked tree.
The tree built allows full XPath expressions from anywhere on the tree.Modifier and Type | Field and Description |
---|---|
protected QNameCache |
cache |
Constructor and Description |
---|
DocumentFactory() |
Modifier and Type | Method and Description |
---|---|
Attribute |
createAttribute(Element owner,
QName qname,
java.lang.String value) |
Attribute |
createAttribute(Element owner,
java.lang.String name,
java.lang.String value) |
CDATA |
createCDATA(java.lang.String text) |
Comment |
createComment(java.lang.String text) |
DocumentType |
createDocType(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId) |
Document |
createDocument() |
Document |
createDocument(Element rootElement) |
Document |
createDocument(java.lang.String encoding)
DOCUMENT ME!
|
Element |
createElement(QName qname) |
Element |
createElement(java.lang.String name) |
Element |
createElement(java.lang.String qualifiedName,
java.lang.String namespaceURI) |
Entity |
createEntity(java.lang.String name,
java.lang.String text) |
Namespace |
createNamespace(java.lang.String prefix,
java.lang.String uri) |
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. |
ProcessingInstruction |
createProcessingInstruction(java.lang.String target,
java.util.Map<java.lang.String,java.lang.String> data) |
ProcessingInstruction |
createProcessingInstruction(java.lang.String target,
java.lang.String data) |
QName |
createQName(java.lang.String localName) |
QName |
createQName(java.lang.String localName,
Namespace namespace) |
QName |
createQName(java.lang.String qualifiedName,
java.lang.String uri) |
QName |
createQName(java.lang.String name,
java.lang.String prefix,
java.lang.String uri) |
protected QNameCache |
createQNameCache()
Factory method to create the QNameCache.
|
protected static DocumentFactory |
createSingleton(java.lang.String className)
createSingleton creates the singleton instance from the
given class name. |
Text |
createText(java.lang.String text) |
XPath |
createXPath(java.lang.String xpathExpression)
createXPath parses an XPath expression and creates a new
XPath XPath instance. |
XPath |
createXPath(java.lang.String xpathExpression,
org.jaxen.VariableContext variableContext)
createXPath parses an XPath expression and creates a new
XPath XPath instance. |
NodeFilter |
createXPathFilter(java.lang.String xpathFilterExpression)
createXPathFilter parses a NodeFilter from the given XPath
filter expression. |
NodeFilter |
createXPathFilter(java.lang.String xpathFilterExpression,
org.jaxen.VariableContext variableContext)
createXPathFilter parses a NodeFilter from the given XPath
filter expression. |
static DocumentFactory |
getInstance()
Access to singleton implementation of DocumentFactory which is used if no
DocumentFactory is specified when building using the standard builders.
|
java.util.List<QName> |
getQNames()
Returns a list of all the QName instances currently used by this document
factory
|
java.util.Map<java.lang.String,java.lang.String> |
getXPathNamespaceURIs()
DOCUMENT ME!
|
protected void |
init() |
protected QName |
intern(QName qname)
DOCUMENT ME!
|
void |
setXPathNamespaceURIs(java.util.Map<java.lang.String,java.lang.String> namespaceURIs)
Sets the namespace URIs to be used by XPath expressions created by this
factory or by nodes associated with this factory.
|
protected transient QNameCache cache
public static DocumentFactory getInstance()
public Document createDocument()
public Document createDocument(java.lang.String encoding)
encoding
- DOCUMENT ME!public DocumentType createDocType(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
public Element createElement(java.lang.String name)
public Element createElement(java.lang.String qualifiedName, java.lang.String namespaceURI)
public Attribute createAttribute(Element owner, QName qname, java.lang.String value)
public Attribute createAttribute(Element owner, java.lang.String name, java.lang.String value)
public CDATA createCDATA(java.lang.String text)
public Comment createComment(java.lang.String text)
public Text createText(java.lang.String text)
public Entity createEntity(java.lang.String name, java.lang.String text)
public Namespace createNamespace(java.lang.String prefix, java.lang.String uri)
public ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
public ProcessingInstruction createProcessingInstruction(java.lang.String target, java.util.Map<java.lang.String,java.lang.String> data)
public QName createQName(java.lang.String localName)
public QName createQName(java.lang.String name, java.lang.String prefix, java.lang.String uri)
public QName createQName(java.lang.String qualifiedName, java.lang.String uri)
public XPath createXPath(java.lang.String xpathExpression) throws InvalidXPathException
createXPath
parses an XPath expression and creates a new
XPath XPath
instance.
xpathExpression
- is the XPath expression to createXPath
instanceInvalidXPathException
- if the XPath expression is invalidpublic XPath createXPath(java.lang.String xpathExpression, org.jaxen.VariableContext variableContext)
createXPath
parses an XPath expression and creates a new
XPath XPath
instance.
xpathExpression
- is the XPath expression to createvariableContext
- is the variable context to use when evaluating the XPathXPath
instancepublic NodeFilter createXPathFilter(java.lang.String xpathFilterExpression, org.jaxen.VariableContext variableContext)
createXPathFilter
parses a NodeFilter from the given XPath
filter expression. XPath filter expressions occur within XPath
expressions such as self::node()[ filterExpression ]
xpathFilterExpression
- is the XPath filter expression to createvariableContext
- is the variable context to use when evaluating the XPathNodeFilter
instancepublic NodeFilter createXPathFilter(java.lang.String xpathFilterExpression)
createXPathFilter
parses a NodeFilter from the given XPath
filter expression. XPath filter expressions occur within XPath
expressions such as self::node()[ filterExpression ]
xpathFilterExpression
- is the XPath filter expression to createNodeFilter
instancepublic 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.
xpathPattern
- is the XPath pattern expression to createPattern
instancepublic java.util.List<QName> getQNames()
public java.util.Map<java.lang.String,java.lang.String> getXPathNamespaceURIs()
public void setXPathNamespaceURIs(java.util.Map<java.lang.String,java.lang.String> namespaceURIs)
namespaceURIs
- DOCUMENT ME!protected static DocumentFactory createSingleton(java.lang.String className)
createSingleton
creates the singleton instance from the
given class name.
className
- is the name of the DocumentFactory class to useprotected QName intern(QName qname)
qname
- DOCUMENT ME!protected QNameCache createQNameCache()
protected void init()