public class DOMConverter
extends java.lang.Object
Converts XOM Document objects to and from DOM
Document objects. This class can also
convert many DOM node objects into the corresponding
XOM node objects. However, the reverse is not possible because
DOM objects cannot live outside their containing
Document.
| Modifier and Type | Method and Description |
|---|---|
static Attribute |
convert(org.w3c.dom.Attr attribute)
Translates a DOM
org.w3c.dom.Attr object
into an equivalent nu.xom.Attribute object. |
static Comment |
convert(org.w3c.dom.Comment comment)
Translates a DOM
org.w3c.dom.Comment object
into an equivalent nu.xom.Comment object. |
static Document |
convert(org.w3c.dom.Document domDocument)
Translates a DOM
org.w3c.dom.Document object
into an equivalent nu.xom.Document object. |
static org.w3c.dom.Document |
convert(Document document,
org.w3c.dom.DOMImplementation impl)
Translates a XOM
nu.xom.Document object
into an equivalent org.w3c.dom.Document
object. |
static Nodes |
convert(org.w3c.dom.DocumentFragment fragment)
Translates a DOM
org.w3c.dom.DocumentFragment
object into an equivalent nu.xom.Nodes object. |
static Nodes |
convert(org.w3c.dom.DocumentFragment fragment,
NodeFactory factory)
Translates a DOM
org.w3c.dom.DocumentFragment
object into an equivalent nu.xom.Nodes object,
converting each DOM node as specified by a factory. |
static Document |
convert(org.w3c.dom.Document domDocument,
NodeFactory factory)
Translates a DOM
org.w3c.dom.Document object
into an equivalent nu.xom.Document object as
controlled by a factory. |
static DocType |
convert(org.w3c.dom.DocumentType doctype)
Translates a DOM
org.w3c.dom.DocumentType
object into an equivalent nu.xom.DocType object. |
static Element |
convert(org.w3c.dom.Element element)
Translates a DOM
org.w3c.dom.Element
object into an equivalent nu.xom.Element object. |
static ProcessingInstruction |
convert(org.w3c.dom.ProcessingInstruction pi)
Translates a DOM
org.w3c.dom.ProcessingInstruction
object into an equivalent
nu.xom.ProcessingInstruction object. |
static Text |
convert(org.w3c.dom.Text text)
Translates a DOM
org.w3c.dom.Text object
into an equivalent nu.xom.Text. |
public static Document convert(org.w3c.dom.Document domDocument)
Translates a DOM org.w3c.dom.Document object
into an equivalent nu.xom.Document object.
The original DOM document is not changed.
Some DOM Document objects cannot
be serialized as namespace well-formed XML, and
thus cannot be converted to XOM.
domDocument - the DOM document to translateXMLException - if the DOM document is not a well-formed
XML documentpublic static Document convert(org.w3c.dom.Document domDocument, NodeFactory factory)
Translates a DOM org.w3c.dom.Document object
into an equivalent nu.xom.Document object as
controlled by a factory.
The original DOM document is not changed.
Some DOM Document objects cannot
be serialized as namespace well-formed XML, and
thus cannot be converted to XOM.
domDocument - the DOM document to translatefactory - the factory that converts each DOM node into
zero or more XOM nodesXMLException - if the DOM document is not a well-formed
XML documentpublic static Nodes convert(org.w3c.dom.DocumentFragment fragment)
Translates a DOM org.w3c.dom.DocumentFragment
object into an equivalent nu.xom.Nodes object.
The original DOM document fragment is not changed.
Some DOM DocumentFragment objects cannot
be serialized as namespace well-balanced XML, and
thus cannot be converted to XOM.
fragment - the DOM document fragment to translateNodes containing the converted
fragment membersXMLException - if the DOM object is not a well-balanced
XML fragmentpublic static Nodes convert(org.w3c.dom.DocumentFragment fragment, NodeFactory factory)
Translates a DOM org.w3c.dom.DocumentFragment
object into an equivalent nu.xom.Nodes object,
converting each DOM node as specified by a factory.
The original DOM document fragment is not changed.
Some DOM DocumentFragment objects cannot
be serialized as namespace well-balanced XML, and
thus cannot be converted to XOM.
fragment - the DOM document fragment to translatefactory - the NodeFactory that converts each DOM node into
a XOM nodeNodes containing the converted
fragment membersXMLException - if the DOM object is not a well-balanced
XML fragmentpublic static Comment convert(org.w3c.dom.Comment comment)
Translates a DOM org.w3c.dom.Comment object
into an equivalent nu.xom.Comment object.
The original DOM object is not changed.
Some DOM Comment objects cannot
be serialized as well-formed XML, and
thus cannot be converted to XOM.
comment - the DOM comment to translateXMLException - if the DOM comment is not a well-formed
XML commentpublic static Text convert(org.w3c.dom.Text text)
Translates a DOM org.w3c.dom.Text object
into an equivalent nu.xom.Text.
This method will also convert org.w3c.dom.CDATA
objects. The original DOM object is not changed.
Some DOM Text objects cannot
be serialized as well-formed XML, and
thus cannot be converted to XOM.
text - the DOM text to translateXMLException - if the DOM text is not a well-formed
XML textpublic static Attribute convert(org.w3c.dom.Attr attribute)
Translates a DOM org.w3c.dom.Attr object
into an equivalent nu.xom.Attribute object.
The original DOM object is not changed.
Some DOM Attr objects cannot
be serialized as well-formed XML, and
thus cannot be converted to XOM. Furthermore, DOM uses
Attr objects to represent namespace declarations.
XOM does not. Converting an Attr object that
represents an xmlns or
xmlns:prefix attribute will cause an
exception.
attribute - the DOM Attr to translateAttributeXMLException - if the DOM Attr
is a namespace declaration or is not a well-formed
XML attributepublic static ProcessingInstruction convert(org.w3c.dom.ProcessingInstruction pi)
Translates a DOM org.w3c.dom.ProcessingInstruction
object into an equivalent
nu.xom.ProcessingInstruction object.
The original DOM object is not changed.
Some DOM ProcessingInstruction objects cannot
be serialized as well-formed XML, and
thus cannot be converted to XOM.
pi - the DOM ProcessingInstruction to
convertProcessingInstructionXMLException - if the DOM ProcessingInstruction
is not a well-formed XML processing instructionpublic static DocType convert(org.w3c.dom.DocumentType doctype)
Translates a DOM org.w3c.dom.DocumentType
object into an equivalent nu.xom.DocType object.
The original DOM object is not changed. Some DOM
DocumentType objects cannot be serialized as
well-formed XML, and thus cannot be converted to XOM.
doctype - the DOM DocumentType to convertDocTypeXMLException - if the DOM DocumentType
is not a well-formed XML document type declarationpublic static Element convert(org.w3c.dom.Element element)
Translates a DOM org.w3c.dom.Element
object into an equivalent nu.xom.Element object.
The original DOM object is not changed. Some DOM
Element objects cannot be serialized as
namespace well-formed XML, and thus cannot be converted to XOM.
element - the DOM Element to convertElementXMLException - if the DOM Element
is not a well-formed XML elementpublic static org.w3c.dom.Document convert(Document document, org.w3c.dom.DOMImplementation impl)
Translates a XOM nu.xom.Document object
into an equivalent org.w3c.dom.Document
object. The original XOM document is not changed.
Since DOM2 internal subsets are read-only,
the internal DTD subset is not converted.
All other aspects of the document should be
translated without a problem.
document - the XOM document to translateimpl - the specific DOM implementation into which this
document will be convertedCopyright 2002-2013 Elliotte Rusty Harold
elharo@ibiblio.org