Class DocumentFactory
java.lang.Object
org.dom4j.DocumentFactory
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BeanDocumentFactory, DOMDocumentFactory, IndexedDocumentFactory, NonLazyDocumentFactory, UserDataDocumentFactory
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.- Author:
- James Strachan
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateAttribute(Element owner, String name, String value) createAttribute(Element owner, QName qname, String value) createCDATA(String text) createComment(String text) createDocType(String name, String publicId, String systemId) createDocument(String encoding) DOCUMENT ME!createDocument(Element rootElement) createElement(String name) createElement(String qualifiedName, String namespaceURI) createElement(QName qname) createEntity(String name, String text) createNamespace(String prefix, String uri) createPattern(String xpathPattern) createPatternparses the given XPath expression to create an XSLT stylePatterninstance which can then be used in an XSLT processing model.createProcessingInstruction(String target, String data) createProcessingInstruction(String target, Map<String, String> data) createQName(String localName) createQName(String qualifiedName, String uri) createQName(String name, String prefix, String uri) createQName(String localName, Namespace namespace) protected QNameCacheFactory method to create the QNameCache.protected static DocumentFactorycreateSingleton(String className) createSingletoncreates the singleton instance from the given class name.createText(String text) createXPath(String xpathExpression) createXPathparses an XPath expression and creates a new XPathXPathinstance.createXPath(String xpathExpression, org.jaxen.VariableContext variableContext) createXPathparses an XPath expression and creates a new XPathXPathinstance.createXPathFilter(String xpathFilterExpression) createXPathFilterparses a NodeFilter from the given XPath filter expression.createXPathFilter(String xpathFilterExpression, org.jaxen.VariableContext variableContext) createXPathFilterparses a NodeFilter from the given XPath filter expression.static DocumentFactoryAccess to singleton implementation of DocumentFactory which is used if no DocumentFactory is specified when building using the standard builders.Returns a list of all the QName instances currently used by this document factoryDOCUMENT ME!protected voidinit()protected QNameDOCUMENT ME!voidsetXPathNamespaceURIs(Map<String, String> namespaceURIs) Sets the namespace URIs to be used by XPath expressions created by this factory or by nodes associated with this factory.
-
Field Details
-
cache
-
-
Constructor Details
-
DocumentFactory
public DocumentFactory()
-
-
Method Details
-
getInstance
Access to singleton implementation of DocumentFactory which is used if no DocumentFactory is specified when building using the standard builders.- Returns:
- the default singleon instance
-
createDocument
-
createDocument
-
createDocument
-
createDocType
-
createElement
-
createElement
-
createElement
-
createAttribute
-
createAttribute
-
createCDATA
-
createComment
-
createText
-
createEntity
-
createNamespace
-
createProcessingInstruction
-
createProcessingInstruction
-
createQName
-
createQName
-
createQName
-
createQName
-
createXPath
createXPathparses an XPath expression and creates a new XPathXPathinstance.- Parameters:
xpathExpression- is the XPath expression to create- Returns:
- a new
XPathinstance - Throws:
InvalidXPathException- if the XPath expression is invalid
-
createXPath
createXPathparses an XPath expression and creates a new XPathXPathinstance.- Parameters:
xpathExpression- is the XPath expression to createvariableContext- is the variable context to use when evaluating the XPath- Returns:
- a new
XPathinstance
-
createXPathFilter
public NodeFilter createXPathFilter(String xpathFilterExpression, org.jaxen.VariableContext variableContext) createXPathFilterparses a NodeFilter from the given XPath filter expression. XPath filter expressions occur within XPath expressions such asself::node()[ filterExpression ]- Parameters:
xpathFilterExpression- is the XPath filter expression to createvariableContext- is the variable context to use when evaluating the XPath- Returns:
- a new
NodeFilterinstance
-
createXPathFilter
createXPathFilterparses a NodeFilter from the given XPath filter expression. XPath filter expressions occur within XPath expressions such asself::node()[ filterExpression ]- Parameters:
xpathFilterExpression- is the XPath filter expression to create- Returns:
- a new
NodeFilterinstance
-
createPattern
-
getQNames
-
getXPathNamespaceURIs
DOCUMENT ME!- Returns:
- 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.
-
setXPathNamespaceURIs
-
createSingleton
createSingletoncreates the singleton instance from the given class name.- Parameters:
className- is the name of the DocumentFactory class to use- Returns:
- a new singleton instance.
-
intern
-
createQNameCache
Factory method to create the QNameCache. This method should be overloaded if you wish to use your own derivation of QName.- Returns:
- DOCUMENT ME!
-
init
protected void init()
-