public class DOMOutputter
extends java.lang.Object
org.jdom2.Document
as a DOM
org.w3c.dom.Document
. Also provides methods to
output other types of JDOM Content in the equivalent DOM nodes.
There are two versions of most functions, one that creates an independent DOM node using the DOMAdapter to create a new org.w3c.dom.Document. The other version creates the new DOM Nodes using the supplied org.w3c.dom.Document instance.
Constructor and Description |
---|
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.
|
DOMOutputter(DOMAdapter adapter)
This creates a new DOMOutputter using the specified DOMAdapter
implementation as a way to choose the underlying parser.
|
DOMOutputter(DOMAdapter adapter,
Format format,
DOMOutputProcessor processor)
The complete constructor for specifying a custom DOMAdaptor, Format, and
DOMOutputProcessor.
|
DOMOutputter(DOMOutputProcessor processor)
This creates a new DOMOutputter which uses the default (JAXP) DOM
implementation but with a custom processor.
|
DOMOutputter(java.lang.String adapterClass)
Deprecated.
use
DOMOutputter(DOMAdapter) instead. |
Modifier and Type | Method and Description |
---|---|
DOMAdapter |
getDOMAdapter()
Get the DOMAdapter currently set for this DOMOutputter.
|
DOMOutputProcessor |
getDOMOutputProcessor()
Get the current DOMOutputProcessor
|
boolean |
getForceNamespaceAware()
Deprecated.
All DOMOutputters are always NamesapceAware. Always true.
|
Format |
getFormat()
Get the Format instance currently used by this DOMOutputter.
|
org.w3c.dom.Attr |
output(Attribute attribute)
This converts the JDOM
Attribute parameter to a DOM Attr
Node, returning the DOM version. |
org.w3c.dom.CDATASection |
output(CDATA cdata)
This converts the JDOM
CDATA parameter to a DOM CDATASection
Node, returning the DOM version. |
org.w3c.dom.Comment |
output(Comment comment)
This converts the JDOM
ProcessingInstruction parameter to a
DOM ProcessingInstruction, returning the DOM version. |
org.w3c.dom.DocumentType |
output(DocType doctype)
This converts the JDOM
DocType parameter to a DOM DocumentType,
returning the DOM version. |
org.w3c.dom.Document |
output(Document document)
This converts the JDOM
Document parameter to a DOM Document,
returning the DOM version. |
org.w3c.dom.Attr |
output(org.w3c.dom.Document basedoc,
Attribute attribute)
This converts the JDOM
Attribute parameter to a DOM Attr
Node, returning the DOM version. |
org.w3c.dom.CDATASection |
output(org.w3c.dom.Document basedoc,
CDATA cdata)
This converts the JDOM
CDATA parameter to a DOM CDATASection
Node, returning the DOM version. |
org.w3c.dom.Comment |
output(org.w3c.dom.Document basedoc,
Comment comment)
This converts the JDOM
ProcessingInstruction parameter to a
DOM ProcessingInstruction, returning the DOM version. |
org.w3c.dom.Element |
output(org.w3c.dom.Document basedoc,
Element element)
This converts the JDOM
Element parameter to a DOM Element,
returning the DOM version. |
org.w3c.dom.EntityReference |
output(org.w3c.dom.Document basedoc,
EntityRef entity)
This converts the JDOM
EntityRef parameter to a DOM
EntityReference Node, returning the DOM version. |
java.util.List<org.w3c.dom.Node> |
output(org.w3c.dom.Document basedoc,
java.util.List<? extends Content> list)
This converts the list of JDOM
Content in to a list of DOM
Nodes, returning the DOM version. |
org.w3c.dom.ProcessingInstruction |
output(org.w3c.dom.Document basedoc,
ProcessingInstruction pi)
This converts the JDOM
ProcessingInstruction parameter to a
DOM ProcessingInstruction, returning the DOM version. |
org.w3c.dom.Text |
output(org.w3c.dom.Document basedoc,
Text text)
This converts the JDOM
Text parameter to a DOM Text Node,
returning the DOM version. |
org.w3c.dom.Element |
output(Element element)
This converts the JDOM
Element parameter to a DOM Element,
returning the DOM version. |
org.w3c.dom.EntityReference |
output(EntityRef entity)
This converts the JDOM
EntityRef parameter to a DOM
EntityReference Node, returning the DOM version. |
java.util.List<org.w3c.dom.Node> |
output(java.util.List<? extends Content> list)
This converts the JDOM
Attribute parameter to a DOM Attr
Node, returning the DOM version. |
org.w3c.dom.ProcessingInstruction |
output(ProcessingInstruction pi)
This converts the JDOM
ProcessingInstruction parameter to a
DOM ProcessingInstruction, returning the DOM version. |
org.w3c.dom.Text |
output(Text text)
This converts the JDOM
Text parameter to a DOM Text Node,
returning the DOM version. |
void |
setDOMAdapter(DOMAdapter adapter)
Set the DOMAdapter currently set for this DOMOutputter.
|
void |
setDOMOutputProcessor(DOMOutputProcessor processor)
Set a new DOMOutputProcessor for this DOMOutputter.
|
void |
setForceNamespaceAware(boolean flag)
Deprecated.
All DOMOutputters are now always NamespaceAware.
|
void |
setFormat(Format format)
Set a new Format instance for this DOMOutputter
|
public DOMOutputter()
public DOMOutputter(DOMOutputProcessor processor)
processor
- the custom processor to use.public DOMOutputter(DOMAdapter adapter, Format format, DOMOutputProcessor processor)
adapter
- The adapter to use to create the base Document instance (null
implies the default).format
- The output Format to use (null implies the default).processor
- The custom mechanism for doing the output (null implies the
default).@Deprecated public DOMOutputter(java.lang.String adapterClass)
DOMOutputter(DOMAdapter)
instead.adapterClass
- String
name of class to use for DOM outputjava.lang.IllegalArgumentException
- if the adapter could not be instantiated. (it should be
JDOMException, but that would require a change to this deprecated
method's signature...public DOMOutputter(DOMAdapter adapter)
If the specified adapter is not thread-safe then the user should ensure
that the adapter instance is never shared between multiple DOMOutputters.
The default DOMAdapter JAXPDOMAdapter
is thread-safe.
adapter
- the DOMAdapter instance to use for creating the base
org.w3c.dom.Document Specify the null value to get the default
adapter.public DOMAdapter getDOMAdapter()
public void setDOMAdapter(DOMAdapter adapter)
adapter
- the new DOMAdapter to use (null implies the default).public Format getFormat()
public void setFormat(Format format)
format
- the new Format instance to use (null implies the default)public DOMOutputProcessor getDOMOutputProcessor()
public void setDOMOutputProcessor(DOMOutputProcessor processor)
processor
- the new processor to set (null implies the default)@Deprecated public void setForceNamespaceAware(boolean flag)
flag
- true to force NamespaceAware@Deprecated public boolean getForceNamespaceAware()
public org.w3c.dom.Document output(Document document) throws JDOMException
Document
parameter to a DOM Document,
returning the DOM version. The DOM implementation is the one supplied by
the current DOMAdapter.document
- Document
to output.org.w3c.dom.Document
versionJDOMException
- if output failed.public org.w3c.dom.DocumentType output(DocType doctype) throws JDOMException
DocType
parameter to a DOM DocumentType,
returning the DOM version. The DOM implementation is the one supplied by
the current DOMAdapter.
Unlike the other DOM Nodes, you cannot use a DOM Document to simply create a DOM DocumentType Node, it has to be created at the same time as the DOM Document instance. As a result, there is no version of this method that takes a DOM Document instance.
doctype
- DocType
to output.org.w3c.dom.DocumentType
versionJDOMException
- if output failed.public org.w3c.dom.Element output(Element element) throws JDOMException
Element
parameter to a DOM Element,
returning the DOM version. The DOM Node will be linked to an independent
DOM Document instance supplied by the current DOMAdapterelement
- Element
to output.org.w3c.dom.Element
versionJDOMException
- if output failed.public org.w3c.dom.Text output(Text text) throws JDOMException
Text
parameter to a DOM Text Node,
returning the DOM version. The DOM Node will be linked to an independent
DOM Document instance supplied by the current DOMAdaptertext
- Text
to output.org.w3c.dom.Text
versionJDOMException
- if output failed.public org.w3c.dom.CDATASection output(CDATA cdata) throws JDOMException
CDATA
parameter to a DOM CDATASection
Node, returning the DOM version. The DOM Node will be linked to an
independent DOM Document instance supplied by the current DOMAdaptercdata
- CDATA
to output.org.w3c.dom.CDATASection
versionJDOMException
- if output failed.public org.w3c.dom.ProcessingInstruction output(ProcessingInstruction pi) throws JDOMException
ProcessingInstruction
parameter to a
DOM ProcessingInstruction, returning the DOM version. The DOM Node will
be linked to an independent DOM Document instance supplied by the current
DOMAdapterpi
- ProcessingInstruction
to output.org.w3c.dom.Element
versionJDOMException
- if output failed.public org.w3c.dom.Comment output(Comment comment) throws JDOMException
ProcessingInstruction
parameter to a
DOM ProcessingInstruction, returning the DOM version. The DOM Node will
be linked to an independent DOM Document instance supplied by the current
DOMAdaptercomment
- Comment
to output.org.w3c.dom.Comment
versionJDOMException
- if output failed.public org.w3c.dom.EntityReference output(EntityRef entity) throws JDOMException
EntityRef
parameter to a DOM
EntityReference Node, returning the DOM version. The DOM Node will be
linked to an independent DOM Document instance supplied by the current
DOMAdapterentity
- EntityRef
to output.org.w3c.dom.EntityReference
versionJDOMException
- if output failed.public org.w3c.dom.Attr output(Attribute attribute) throws JDOMException
Attribute
parameter to a DOM Attr
Node, returning the DOM version. The DOM Node will be linked to an
independent DOM Document instance supplied by the current DOMAdapterattribute
- Attribute
to output.org.w3c.dom.Attr
versionJDOMException
- if output failed.public java.util.List<org.w3c.dom.Node> output(java.util.List<? extends Content> list) throws JDOMException
Attribute
parameter to a DOM Attr
Node, returning the DOM version. The DOM Node will be linked to an
independent DOM Document instance supplied by the current DOMAdapterlist
- Attribute
to output.org.w3c.dom.Attr
versionJDOMException
- if output failed.public org.w3c.dom.Element output(org.w3c.dom.Document basedoc, Element element) throws JDOMException
Element
parameter to a DOM Element,
returning the DOM version. The DOM Node will be linked to an independent
DOM Document instance supplied by the current DOMAdapterbasedoc
- The DOM Document to use for creating DOM Nodes.element
- Element
to output.org.w3c.dom.Element
versionJDOMException
- if output failed.public org.w3c.dom.Text output(org.w3c.dom.Document basedoc, Text text) throws JDOMException
Text
parameter to a DOM Text Node,
returning the DOM version. The DOM Node will be linked to an independent
DOM Document instance supplied by the current DOMAdapterbasedoc
- The DOM Document to use for creating DOM Nodes.text
- Text
to output.org.w3c.dom.Text
versionJDOMException
- if output failed.public org.w3c.dom.CDATASection output(org.w3c.dom.Document basedoc, CDATA cdata) throws JDOMException
CDATA
parameter to a DOM CDATASection
Node, returning the DOM version. The DOM Node will be linked to an
independent DOM Document instance supplied by the current DOMAdapterbasedoc
- The DOM Document to use for creating DOM Nodes.cdata
- CDATA
to output.org.w3c.dom.CDATASection
versionJDOMException
- if output failed.public org.w3c.dom.ProcessingInstruction output(org.w3c.dom.Document basedoc, ProcessingInstruction pi) throws JDOMException
ProcessingInstruction
parameter to a
DOM ProcessingInstruction, returning the DOM version. The DOM Node will
be linked to an independent DOM Document instance supplied by the current
DOMAdapterbasedoc
- The DOM Document to use for creating DOM Nodes.pi
- ProcessingInstruction
to output.org.w3c.dom.Element
versionJDOMException
- if output failed.public org.w3c.dom.Comment output(org.w3c.dom.Document basedoc, Comment comment) throws JDOMException
ProcessingInstruction
parameter to a
DOM ProcessingInstruction, returning the DOM version. The DOM Node will
be linked to an independent DOM Document instance supplied by the current
DOMAdapterbasedoc
- The DOM Document to use for creating DOM Nodes.comment
- Comment
to output.org.w3c.dom.Comment
versionJDOMException
- if output failed.public org.w3c.dom.EntityReference output(org.w3c.dom.Document basedoc, EntityRef entity) throws JDOMException
EntityRef
parameter to a DOM
EntityReference Node, returning the DOM version. The DOM Node will be
linked to an independent DOM Document instance supplied by the current
DOMAdapterbasedoc
- The DOM Document to use for creating DOM Nodes.entity
- EntityRef
to output.org.w3c.dom.EntityReference
versionJDOMException
- if output failed.public org.w3c.dom.Attr output(org.w3c.dom.Document basedoc, Attribute attribute) throws JDOMException
Attribute
parameter to a DOM Attr
Node, returning the DOM version. The DOM Node will be linked to an
independent DOM Document instance supplied by the current DOMAdapterbasedoc
- The DOM Document to use for creating DOM Nodes.attribute
- Attribute
to output.org.w3c.dom.Attr
versionJDOMException
- if output failed.public java.util.List<org.w3c.dom.Node> output(org.w3c.dom.Document basedoc, java.util.List<? extends Content> list) throws JDOMException
Content
in to a list of DOM
Nodes, returning the DOM version. The DOM Node will be linked to an
independent DOM Document instance supplied by the current DOMAdapterbasedoc
- The DOM Document to use for creating DOM Nodes.list
- of JDOM Content to output.org.w3c.dom.Node
JDOMException
- if output failed.Copyright © 2021 Jason Hunter, Brett McLaughlin. All Rights Reserved.