Top Description Fields Constructors Methods
org.jdom.output

public Class DOMOutputter

extends Object
Class Inheritance
Imports
java.util.*, org.jdom.*, org.jdom.adapters.*

Outputs a JDOM org.jdom.Document as a DOM org.w3c.dom.Document.
Authors
Brett McLaughlin, Jason Hunter, Matthew Merlo, Dan Schaffer, Yusuf Goolamabbas, Bradley S. Huffman
Version
$Revision: 1.43 $, $Date: 2007/11/10 05:29:01 $

Field Summary

Modifier and TypeField and Description
private String
adapterClass

Adapter to use for interfacing with the DOM implementation

private static final String
private static final String
DEFAULT_ADAPTER_CLASS

Default adapter class

private boolean
forceNamespaceAware

Output a DOM with namespaces but just the empty namespace

Constructor Summary

AccessConstructor and Description
public
DOMOutputter()

This creates a new DOMOutputter which will attempt to first locate a DOM implementation to use via JAXP, and if JAXP does not exist or there's a problem, will fall back to the default parser.

public
DOMOutputter(String
String name of class to use for DOM output
adapterClass
)

This creates a new DOMOutputter using the specified DOMAdapter implementation as a way to choose the underlying parser.

Method Summary

Modifier and TypeMethod and Description
private Document
public boolean

Returns:

the forceNamespaceAware flag value
getForceNamespaceAware
()

Returns whether DOMs will be constructed with namespaces even when the source document has elements all in the empty namespace.

private static String
getXmlnsTagFor(Namespace
Namespace to add definition of
ns
)

This will handle adding any Namespace attributes to the DOM tree.

public Document

Returns:

an org.w3c.dom.Document version
output
(Document
Document to output.
document
)

This converts the JDOM Document parameter to a DOM Document, returning the DOM version.

private Element
output(Element element, Document domDoc, NamespaceStack namespaces)

private Attr
output(Attribute attribute, Document domDoc)

public void
setForceNamespaceAware(boolean flag)

Controls how NO_NAMESPACE nodes are handeled.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

adapterClassback to summary
private String adapterClass

Adapter to use for interfacing with the DOM implementation

CVS_IDback to summary
private static final String CVS_ID
DEFAULT_ADAPTER_CLASSback to summary
private static final String DEFAULT_ADAPTER_CLASS

Default adapter class

forceNamespaceAwareback to summary
private boolean forceNamespaceAware

Output a DOM with namespaces but just the empty namespace

Constructor Detail

DOMOutputterback to summary
public DOMOutputter()

This creates a new DOMOutputter which will attempt to first locate a DOM implementation to use via JAXP, and if JAXP does not exist or there's a problem, will fall back to the default parser.

DOMOutputterback to summary
public DOMOutputter(String adapterClass)

This creates a new DOMOutputter using the specified DOMAdapter implementation as a way to choose the underlying parser.

Parameters
adapterClass:String

String name of class to use for DOM output

Method Detail

createDOMDocumentback to summary
private Document createDOMDocument(DocType dt) throws JDOMException
getForceNamespaceAwareback to summary
public boolean getForceNamespaceAware()

Returns whether DOMs will be constructed with namespaces even when the source document has elements all in the empty namespace.

Returns:boolean

the forceNamespaceAware flag value

getXmlnsTagForback to summary
private static String getXmlnsTagFor(Namespace ns)

This will handle adding any Namespace attributes to the DOM tree.

Parameters
ns:Namespace

Namespace to add definition of

outputback to summary
public Document output(Document document) throws JDOMException

This converts the JDOM Document parameter to a DOM Document, returning the DOM version. The DOM implementation is the one chosen in the constructor.

Parameters
document:Document

Document to output.

Returns:Document

an org.w3c.dom.Document version

outputback to summary
private Element output(Element element, Document domDoc, NamespaceStack namespaces) throws JDOMException
outputback to summary
private Attr output(Attribute attribute, Document domDoc) throws JDOMException
setForceNamespaceAwareback to summary
public void setForceNamespaceAware(boolean flag)

Controls how NO_NAMESPACE nodes are handeled. If true the outputter always creates a namespace aware DOM.