Interface DOMAdapter
-
- All Known Implementing Classes:
AbstractDOMAdapter
,JAXPDOMAdapter
,XML4JDOMAdapter
public interface DOMAdapter
Defines a standard set of adapter methods for interfacing with a DOM parser and obtaining a DOMorg.w3c.dom.Document
object. Instances of this interface are used by theDOMOutputter
class to create a DOM output result using the org.w3c.dom.Document implementation returned by these methods.You should never need to implement this interface unless you have a specific need to use something other than the default JAXP-based mechanism.
JDOM only provides one 'concrete' implementation of the DOMAdapter: the
JAXPDOMAdapter
class. That implementation is a thread-safe and efficient implementation. It can be used as a template for building your own custom DOMAdapter implementation, if you need it.The
AbstractDOMAdapter
class could help you by implementing the DocType-based method which leverages the base createDocument() method.Special note for implementation of DOMAdapter: For backward compatibility with JDOM 1.x (which allows a class-name to be used to specify a DOMAdapter in the DOMOoutputter class), it is required that your implementations of DOMAdapter have a no-argument default constructor. If you require a constructor argument then you have to ensure that you use the correct (non-deprecated) mechanisms on DOMOutputter to specify your custom DOMAdapter.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Document
createDocument()
This creates an emptyDocument
object based on a specific parser implementation.Document
createDocument(DocType doctype)
This creates an emptyDocument
object based on a specific parser implementation with the given DOCTYPE.
-
-
-
Method Detail
-
createDocument
Document createDocument() throws JDOMException
This creates an emptyDocument
object based on a specific parser implementation.- Returns:
Document
- created DOM Document.- Throws:
JDOMException
- if an error occurs.
-
createDocument
Document createDocument(DocType doctype) throws JDOMException
This creates an emptyDocument
object based on a specific parser implementation with the given DOCTYPE.- Parameters:
doctype
- InitialDocType
of the document.- Returns:
Document
- created DOM Document.- Throws:
JDOMException
- if an error occurs.
-
-