|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.codehaus.staxmate.dom.DOMConverter
public class DOMConverter
Class that can build DOM trees and fragments using Stax stream readers, and write them out using Stax stream writers.
| Field Summary | |
|---|---|
protected javax.xml.parsers.DocumentBuilder |
_docBuilder
|
protected boolean |
_inputCfgIgnoreWs
Whether ignorable white space should be ignored, ie not added in the resulting JDOM tree. |
| Constructor Summary | |
|---|---|
DOMConverter()
|
|
DOMConverter(javax.xml.parsers.DocumentBuilder b)
|
|
| Method Summary | |
|---|---|
protected void |
_build(javax.xml.stream.XMLStreamReader r0,
org.w3c.dom.Document doc)
This method takes a XMLStreamReader and builds up
a JDOM tree. |
protected java.lang.String |
_buildDTD(org.w3c.dom.DocumentType doctype)
|
protected static boolean |
_isNamespaceAware(javax.xml.stream.XMLStreamReader r)
|
protected void |
_writeElement(org.codehaus.stax2.XMLStreamWriter2 sw,
org.w3c.dom.Element elem)
Method called to output an element node and all of its children (recursively). |
protected void |
_writeNode(org.codehaus.stax2.XMLStreamWriter2 sw,
org.w3c.dom.Node node)
|
org.w3c.dom.Document |
buildDocument(javax.xml.stream.XMLStreamReader r)
This method will create a Document instance using
the default JAXP DOM document construction mechanism and
populated using the given StAX stream reader. |
void |
buildDocument(javax.xml.stream.XMLStreamReader r,
org.w3c.dom.Document doc)
This method will populate given Document using
the given StAX stream reader instance. |
org.w3c.dom.Document |
buildDocument(javax.xml.stream.XMLStreamReader r,
javax.xml.parsers.DocumentBuilder docbuilder)
This method will create a Document instance using
given DocumentBuilder and
populated using the given StAX stream reader. |
void |
setIgnoreWhitespace(boolean state)
Method used to change whether the build methods will add ignorable (element) white space in the DOM tree or not. |
void |
writeDocument(org.w3c.dom.Document doc,
javax.xml.stream.XMLStreamWriter sw0)
Method for writing out given DOM document using specified stream writer. |
void |
writeFragment(org.w3c.dom.NodeList nodes,
javax.xml.stream.XMLStreamWriter sw0)
|
void |
writeFragment(org.w3c.dom.Node node,
javax.xml.stream.XMLStreamWriter sw0)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final javax.xml.parsers.DocumentBuilder _docBuilder
protected boolean _inputCfgIgnoreWs
| Constructor Detail |
|---|
public DOMConverter()
public DOMConverter(javax.xml.parsers.DocumentBuilder b)
| Method Detail |
|---|
public void setIgnoreWhitespace(boolean state)
Whether all-whitespace text segment is ignorable white space or not is based on DTD read in, as per XML specifications (white space is only significant in mixed content or pure text elements).
public org.w3c.dom.Document buildDocument(javax.xml.stream.XMLStreamReader r)
throws javax.xml.stream.XMLStreamException
Document instance using
the default JAXP DOM document construction mechanism and
populated using the given StAX stream reader.
Namespace-awareness will be enabled for the
DocumentBuilderFactory constructed; if this is not wanted,
caller should construct DocumentBuilder separately.
Note: underlying stream reader will be closed by the method, but generally this does NOT mean that the stream will be (as per Stax 1.0 specs which defined behavior of XMLStreamReader.close().
r - Stream reader from which input is read.
Document - DOM document object.
javax.xml.stream.XMLStreamException - If the reader threw such exception (to
indicate a parsing or I/O problem)
public org.w3c.dom.Document buildDocument(javax.xml.stream.XMLStreamReader r,
javax.xml.parsers.DocumentBuilder docbuilder)
throws javax.xml.stream.XMLStreamException
Document instance using
given DocumentBuilder and
populated using the given StAX stream reader.
Note: underlying stream reader will be closed by the method, but generally this does NOT mean that the stream will be (as per Stax 1.0 specs which defined behavior of XMLStreamReader.close().
r - Stream reader from which input is read.
Document - DOM document object.
javax.xml.stream.XMLStreamException - If the reader threw such exception (to
indicate a parsing or I/O problem)
public void buildDocument(javax.xml.stream.XMLStreamReader r,
org.w3c.dom.Document doc)
throws javax.xml.stream.XMLStreamException
Document using
the given StAX stream reader instance.
Note: underlying stream reader will be closed by the method, but generally this does NOT mean that the stream will be (as per Stax 1.0 specs which defined behavior of XMLStreamReader.close().
r - Stream reader from which input is read.
javax.xml.stream.XMLStreamException - If the reader threw such exception (to
indicate a parsing or I/O problem)
protected void _build(javax.xml.stream.XMLStreamReader r0,
org.w3c.dom.Document doc)
throws javax.xml.stream.XMLStreamException
XMLStreamReader and builds up
a JDOM tree. Recursion has been eliminated by using nodes'
parent/child relationship; this improves performance somewhat
(classic recursion-by-iteration-and-explicit stack transformation)
r0 - Stream reader to use for reading the document from which
to build the treedoc - Document being built.
javax.xml.stream.XMLStreamException
public void writeDocument(org.w3c.dom.Document doc,
javax.xml.stream.XMLStreamWriter sw0)
throws javax.xml.stream.XMLStreamException
Note: only regular XMLStreamWriter.close() is
called on the stream writer. This usually means that the underlying
stream is not closed (as per Stax 1.0 specification).
javax.xml.stream.XMLStreamException
public void writeFragment(org.w3c.dom.NodeList nodes,
javax.xml.stream.XMLStreamWriter sw0)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public void writeFragment(org.w3c.dom.Node node,
javax.xml.stream.XMLStreamWriter sw0)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected static boolean _isNamespaceAware(javax.xml.stream.XMLStreamReader r)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void _writeNode(org.codehaus.stax2.XMLStreamWriter2 sw,
org.w3c.dom.Node node)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected java.lang.String _buildDTD(org.w3c.dom.DocumentType doctype)
protected void _writeElement(org.codehaus.stax2.XMLStreamWriter2 sw,
org.w3c.dom.Element elem)
throws javax.xml.stream.XMLStreamException
elem - Element to output
javax.xml.stream.XMLStreamException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||