JDOM
2.0.5

org.jdom2.adapters
Interface DOMAdapter

All Known Implementing Classes:
AbstractDOMAdapter, JAXPDOMAdapter

public interface DOMAdapter

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.

Author:
Brett McLaughlin, Jason Hunter

Method Summary
 org.w3c.dom.Document createDocument()
          This creates an empty Document object based on a specific parser implementation.
 org.w3c.dom.Document createDocument(DocType doctype)
          This creates an empty Document object based on a specific parser implementation with the given DOCTYPE.
 

Method Detail

createDocument

org.w3c.dom.Document createDocument()
                                    throws JDOMException
This creates an empty Document object based on a specific parser implementation.

Returns:
Document - created DOM Document.
Throws:
JDOMException - if an error occurs.

createDocument

org.w3c.dom.Document createDocument(DocType doctype)
                                    throws JDOMException
This creates an empty Document object based on a specific parser implementation with the given DOCTYPE.

Parameters:
doctype - Initial DocType of the document.
Returns:
Document - created DOM Document.
Throws:
JDOMException - if an error occurs.

JDOM
2.0.5

Copyright 2013 Jason Hunter, Brett McLaughlin. All Rights Reserved.