Class Stax2DomBuilder

java.lang.Object
org.red5.io.utils.Stax2DomBuilder

public class Stax2DomBuilder extends Object
Builds a DOM Document using a XMLStreamReader.
Version:
$Revision: 1.00 $, $Date: 2004/12/11 00:00:00 $
Author:
Tatu Saloranta
  • Field Details

    • mCfgIgnoreWs

      protected boolean mCfgIgnoreWs
      Whether 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

      protected String mLastPrefix
    • mLastLocalName

      protected String mLastLocalName
    • mLastQName

      protected String 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 a Document instance 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 configured
      XMLStreamException - If the reader threw such exception (to indicate a parsing or I/O problem)
    • build

      public Document build(XMLStreamReader r, DocumentBuilder docbuilder) throws XMLStreamException
      Throws:
      XMLStreamException
    • build

      public void build(XMLStreamReader r, Document doc) throws XMLStreamException
      This method will populate given Document using 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

      protected void buildTree(XMLStreamReader r, Document doc) throws XMLStreamException
      This method takes a 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)
      Parameters:
      r - Stream reader to use for reading the document from which to build the tree
      doc - JDOM Document being built.
      Throws:
      XMLStreamException - for fun
    • getQualified

      protected String getQualified(String prefix, String localName)
    • checkReaderSettings

      protected void checkReaderSettings(XMLStreamReader r) throws XMLStreamException
      Throws:
      XMLStreamException