Top Description Methods
org.jdom2.adapters

public Interface DOMAdapter

Known Direct Implementers
org.jdom2.adapters.AbstractDOMAdapter
Imports
org.jdom2.DocType, .JDOMException, org.jdom2.output.DOMOutputter, org.w3c.dom.Document

Defines a standard set of adapter methods for interfacing with a DOM parser and obtaining a DOM org.w3c.dom.Document object. Instances of this interface are used by the DOMOutputter 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.

Authors
Brett McLaughlin, Jason Hunter

Method Summary

Modifier and TypeMethod and Description
public Document

Returns:

Document - created DOM Document.
createDocument
()

This creates an empty Document object based on a specific parser implementation.

public Document

Returns:

Document - created DOM Document.
createDocument
(DocType
Initial DocType of the document.
doctype
)

This creates an empty Document object based on a specific parser implementation with the given DOCTYPE.

Method Detail

createDocumentback to summary
public Document createDocument() throws JDOMException

This creates an empty Document object based on a specific parser implementation.

Returns:Document

Document - created DOM Document.

Exceptions
JDOMException:
if an error occurs.
createDocumentback to summary
public Document createDocument(DocType doctype) throws JDOMException

This creates an empty Document object based on a specific parser implementation with the given DOCTYPE.

Parameters
doctype:DocType

Initial DocType of the document.

Returns:Document

Document - created DOM Document.

Exceptions
JDOMException:
if an error occurs.