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.
createAttribute
public Attribute createAttribute(Element owner,
String name,
String value)
createCDATA
public CDATA createCDATA(String text)
createComment
public Comment createComment(String text)
createDocType
public DocumentType createDocType(String name,
String publicId,
String systemId)
createDocument
public Document createDocument()
createDocument
public Document createDocument(String encoding)
DOCUMENT ME!
createElement
public Element createElement(String name)
createElement
public Element createElement(String qualifiedName,
String namespaceURI)
createEntity
public Entity createEntity(String name,
String text)
createNamespace
public Namespace createNamespace(String prefix,
String uri)
createPattern
public 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 ProcessingInstruction createProcessingInstruction(String target,
Map data)
createProcessingInstruction
public ProcessingInstruction createProcessingInstruction(String target,
String data)
createQName
public QName createQName(String localName)
createQName
public QName createQName(String qualifiedName,
String uri)
createQName
public QName createQName(String name,
String prefix,
String uri)
createQName
public QName createQName(String localName,
Namespace namespace)
createQNameCache
protected org.dom4j.tree.QNameCache createQNameCache()
Factory method to create the QNameCache. This method should be overloaded
if you wish to use your own derivation of QName.
createSingleton
protected static DocumentFactory createSingleton(String className)
createSingleton
creates the singleton instance from the
given class name.
className
- is the name of the DocumentFactory class to use
- a new singleton instance.
createText
public Text createText(String text)
createXPath
public XPath createXPath(String xpathExpression)
throws InvalidXPathException
createXPath
parses an XPath expression and creates a new
XPath XPath
instance.
xpathExpression
- is the XPath expression to create
createXPath
public XPath createXPath(String xpathExpression,
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 XPath
createXPathFilter
public NodeFilter createXPathFilter(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 create
- a new
NodeFilter
instance
createXPathFilter
public NodeFilter createXPathFilter(String xpathFilterExpression,
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 XPath
- a new
NodeFilter
instance
getInstance
public static DocumentFactory getInstance()
Access to singleton implementation of DocumentFactory which is used if no
DocumentFactory is specified when building using the standard builders.
- the default singleon instance
getQNames
public List getQNames()
Returns a list of all the QName instances currently used by this document
factory
getXPathNamespaceURIs
public Map getXPathNamespaceURIs()
DOCUMENT ME!
- the Map of namespace URIs that will be used by by XPath
expressions to resolve namespace prefixes into namespace URIs.
The map is keyed by namespace prefix and the value is the
namespace URI. This value could well be null to indicate no
namespace URIs are being mapped.
init
protected void init()
intern
protected QName intern(QName qname)
DOCUMENT ME!
- the cached QName instance if there is one or adds the given qname
to the cache if not
setXPathNamespaceURIs
public void setXPathNamespaceURIs(Map namespaceURIs)
Sets the namespace URIs to be used by XPath expressions created by this
factory or by nodes associated with this factory. The keys are namespace
prefixes and the values are namespace URIs.
namespaceURIs
- DOCUMENT ME!