org.red5.io.utils
public class Stax2DomBuilder extends Object
Document
using a
XMLStreamReader
.Modifier and Type | Field and Description |
---|---|
protected boolean |
mCfgIgnoreWs
Whether ignorable white space should be ignored, ie not added in the
resulting JDOM tree.
|
protected String |
mLastLocalName |
protected String |
mLastPrefix |
protected String |
mLastQName |
protected boolean |
mNsAware |
Constructor and Description |
---|
Stax2DomBuilder()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
Document |
build(XMLStreamReader r)
This method will create a
Document instance using the
default JAXP mechanism and populate using the given StAX stream reader. |
void |
build(XMLStreamReader r,
Document doc)
This method will populate given
Document using the
given StAX stream reader instance. |
Document |
build(XMLStreamReader r,
DocumentBuilder docbuilder) |
protected void |
buildTree(XMLStreamReader r,
Document doc)
This method takes a
XMLStreamReader and builds up a JDOM
tree. |
protected void |
checkReaderSettings(XMLStreamReader r) |
protected String |
getQualified(String prefix,
String localName) |
void |
setIgnoreWhitespace(boolean ignoreWS)
Method used to change whether the build methods will add ignorable
(element) white space in the DOM tree or not.
|
protected boolean mCfgIgnoreWs
protected boolean mNsAware
protected String mLastPrefix
protected String mLastLocalName
protected String mLastQName
public void setIgnoreWhitespace(boolean ignoreWS)
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).
ignoreWS
- true to ignore whitespace; false otherwise.public Document build(XMLStreamReader r) throws ParserConfigurationException, XMLStreamException
Document
instance using the
default JAXP mechanism and populate using the given StAX stream reader.r
- Stream reader from which input is read.Document
- DOM document object.ParserConfigurationException
- if parse is not configuredXMLStreamException
- If the reader threw such exception (to indicate a parsing or
I/O problem)public Document build(XMLStreamReader r, DocumentBuilder docbuilder) throws XMLStreamException
XMLStreamException
public void build(XMLStreamReader r, Document doc) throws XMLStreamException
Document
using the
given StAX stream reader instance.r
- Stream reader from which input is read.doc
- Document
- DOM document object.XMLStreamException
- If the reader threw such exception (to indicate a parsing or
I/O problem)protected void buildTree(XMLStreamReader r, Document doc) throws 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)r
- Stream reader to use for reading the document from which to
build the treedoc
- JDOM Document
being built.XMLStreamException
- for funprotected void checkReaderSettings(XMLStreamReader r) throws XMLStreamException
XMLStreamException
Copyright © 2006-2012 The Red5 Project