Package org.red5.io.utils
Class Stax2DomBuilder
java.lang.Object
org.red5.io.utils.Stax2DomBuilder
Builds a DOM
Document using a XMLStreamReader.- Version:
- $Revision: 1.00 $, $Date: 2004/12/11 00:00:00 $
- Author:
- Tatu Saloranta
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method will create aDocumentinstance using the default JAXP mechanism and populate using the given StAX stream reader.build(XMLStreamReader r, DocumentBuilder docbuilder) voidbuild(XMLStreamReader r, Document doc) This method will populate givenDocumentusing the given StAX stream reader instance.protected voidbuildTree(XMLStreamReader r, Document doc) This method takes aXMLStreamReaderand builds up a JDOM tree.protected voidprotected StringgetQualified(String prefix, String localName) voidsetIgnoreWhitespace(boolean ignoreWS) Method used to change whether the build methods will add ignorable (element) white space in the DOM tree or not.
-
Field Details
-
mCfgIgnoreWs
protected boolean mCfgIgnoreWsWhether ignorable white space should be ignored, ie not added in the resulting JDOM tree. If true, it will be ignored; if false, it will be added in the tree. Default value if false. -
mNsAware
protected boolean mNsAware -
mLastPrefix
-
mLastLocalName
-
mLastQName
-
-
Constructor Details
-
Stax2DomBuilder
public Stax2DomBuilder()Default constructor.
-
-
Method Details
-
setIgnoreWhitespace
public void setIgnoreWhitespace(boolean ignoreWS) Method used to change whether the build methods will add ignorable (element) white space in the DOM tree or not.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).
- Parameters:
ignoreWS- true to ignore whitespace; false otherwise.
-
build
This method will create aDocumentinstance using the default JAXP mechanism and populate using the given StAX stream reader.- Parameters:
r- Stream reader from which input is read.- Returns:
Document- DOM document object.- Throws:
ParserConfigurationException- if parse is not configuredXMLStreamException- If the reader threw such exception (to indicate a parsing or I/O problem)
-
build
- Throws:
XMLStreamException
-
build
This method will populate givenDocumentusing the given StAX stream reader instance.- Parameters:
r- Stream reader from which input is read.doc-Document- DOM document object.- Throws:
XMLStreamException- If the reader threw such exception (to indicate a parsing or I/O problem)
-
buildTree
This method takes aXMLStreamReaderand 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)- Parameters:
r- Stream reader to use for reading the document from which to build the treedoc- JDOMDocumentbeing built.- Throws:
XMLStreamException- for fun
-
getQualified
-
checkReaderSettings
- Throws:
XMLStreamException
-