Package org.dom4j

Class DocumentFactory

    • Constructor Detail

      • DocumentFactory

        public DocumentFactory()
    • Method Detail

      • 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.
        Returns:
        the default singleon instance
      • createDocument

        public Document createDocument()
      • createDocument

        public Document createDocument​(String encoding)
        DOCUMENT ME!
        Parameters:
        encoding - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
        Since:
        1.5
      • createElement

        public Element createElement​(QName qname)
      • createCDATA

        public CDATA createCDATA​(String text)
      • createText

        public Text createText​(String text)
      • createQName

        public QName createQName​(String localName)
      • createXPath

        public XPath createXPath​(String xpathExpression)
                          throws InvalidXPathException

        createXPath parses an XPath expression and creates a new XPath XPath instance.

        Parameters:
        xpathExpression - is the XPath expression to create
        Returns:
        a new XPath instance
        Throws:
        InvalidXPathException - if the XPath expression is invalid
      • createXPath

        public XPath createXPath​(String xpathExpression,
                                 org.jaxen.VariableContext variableContext)

        createXPath parses an XPath expression and creates a new XPath XPath instance.

        Parameters:
        xpathExpression - is the XPath expression to create
        variableContext - is the variable context to use when evaluating the XPath
        Returns:
        a new XPath instance
      • createXPathFilter

        public NodeFilter createXPathFilter​(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 ]

        Parameters:
        xpathFilterExpression - is the XPath filter expression to create
        variableContext - is the variable context to use when evaluating the XPath
        Returns:
        a new NodeFilter instance
      • 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 ]

        Parameters:
        xpathFilterExpression - is the XPath filter expression to create
        Returns:
        a new NodeFilter instance
      • createPattern

        public Pattern createPattern​(String xpathPattern)

        createPattern parses the given XPath expression to create an XSLT style Patterninstance which can then be used in an XSLT processing model.

        Parameters:
        xpathPattern - is the XPath pattern expression to create
        Returns:
        a new Pattern instance
      • getQNames

        public List<QName> getQNames()
        Returns a list of all the QName instances currently used by this document factory
        Returns:
        DOCUMENT ME!
      • getXPathNamespaceURIs

        public Map<String,​String> 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

        public void setXPathNamespaceURIs​(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. The keys are namespace prefixes and the values are namespace URIs.
        Parameters:
        namespaceURIs - DOCUMENT ME!
      • createSingleton

        protected static DocumentFactory createSingleton​(String className)

        createSingleton creates 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

        protected QName intern​(QName qname)
        DOCUMENT ME!
        Parameters:
        qname - DOCUMENT ME!
        Returns:
        the cached QName instance if there is one or adds the given qname to the cache if not
      • createQNameCache

        protected QNameCache 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()