oracle.xml.async

## Class DOMBuilder

- java.lang.Object
- - oracle.xml.async.DOMBuilder

All Implemented Interfaces:
  java.io.Serializable, java.lang.Runnable

    public class DOMBuilder
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Runnable

This class encapsulates an eXtensible Markup Language (XML) 1.0 parser to parse an XML document and build a DOM tree. The parsing is done in a separate thread and DOMBuilderListener interface must be used for notification when the tree is built.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`DOMBuilder()` Creates a new parser object.
`DOMBuilder(int id)` Creates a new parser object with a given id.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addDOMBuilderErrorListener(DOMBuilderErrorListener p0)` Adds DOMBuilderErrorListener
`void` `addDOMBuilderListener(DOMBuilderListener p0)` Adds DOMBuilderListener
`DTD` `getDoctype()` Get the DTD
`XMLDocument` `getDocument()` Gets the document
`int` `getId()` Returns the parser object id.
`java.lang.String` `getReleaseVersion()` Returns the release version of the Oracle XML Parser
`Document` `getResult()` Gets the document
`boolean` `getValidationMode()` Returns the validation mode
`void` `parse(InputSource in)` Parses the XML from given input source
`void` `parse(java.io.InputStream in)` Parses the XML from given input stream.
`void` `parse(java.io.Reader r)` Parses the XML from given input stream.
`void` `parse(java.lang.String in)` Parses the XML from the URL indicated
`void` `parse(java.net.URL url)` Parses the XML document pointed to by the given URL and creates the corresponding XML document hierarchy.
`void` `parseDTD(InputSource in, java.lang.String rootName)` Parses the XML External DTD from given input source
`void` `parseDTD(java.io.InputStream in, java.lang.String rootName)` Parses the XML External DTD from given input stream.
`void` `parseDTD(java.io.Reader r, java.lang.String rootName)` Parses the XML External DTD from given input stream.
`void` `parseDTD(java.lang.String in, java.lang.String rootName)` Parses the XML External DTD from the URL indicated
`void` `parseDTD(java.net.URL url, java.lang.String rootName)` Parses the XML External DTD document pointed to by the given URL and creates the corresponding XML document hierarchy.
`void` `removeDOMBuilderErrorListener(DOMBuilderErrorListener p0)` Remove DOMBuilderErrorListener
`void` `removeDOMBuilderListener(DOMBuilderListener p0)` Remove DOMBuilderListener
`void` `run()` This method runs in a thread
`void` `setBaseURL(java.net.URL url)` Set the base URL for loading external enitites and DTDs.
`void` `setDebugMode(boolean flag)` Sets a flag to turn on debug information in the document
`void` `setDoctype(DTD dtd)` Set the DTD
`void` `setErrorStream(java.io.OutputStream out)` Creates an output stream for the output of errors and warnings.
`void` `setErrorStream(java.io.OutputStream out, java.lang.String enc)` Creates an output stream for the output of errors and warnings.
`void` `setErrorStream(java.io.PrintWriter out)` Creates an output stream for the output of errors and warnings.
`void` `setNodeFactory(NodeFactory factory)` Set the node factory.
`void` `setPreserveWhitespace(boolean flag)` Set the white space preserving mode
`void` `setSecureProcessing()` Set secure parsing
`void` `setValidationMode(boolean yes)` Set the validation mode
`void` `showWarnings(boolean yes)` Switch to determine whether to print warnings

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DOMBuilder

    public DOMBuilder()

Creates a new parser object.

#### DOMBuilder

    public DOMBuilder(int id)

Creates a new parser object with a given id.

Parameters:
  `id` - The `DOMBuilder` id.

### Method Detail

#### getId

    public int getId()

Returns the parser object id.

Returns:
  The `DOMBuilder` id

#### setSecureProcessing

    public void setSecureProcessing()

Set secure parsing

#### run

    public void run()

This method runs in a thread

Specified by:
  `run` in interface `java.lang.Runnable`

#### addDOMBuilderListener

    public void addDOMBuilderListener(DOMBuilderListener p0)

Adds DOMBuilderListener

Parameters:
  `p0` - The `DOMBuilderListener` to add

#### addDOMBuilderErrorListener

    public void addDOMBuilderErrorListener(DOMBuilderErrorListener p0)

Adds DOMBuilderErrorListener

Parameters:
  `p0` - The `DOMBuilderErrorListener` to add

#### removeDOMBuilderListener

    public void removeDOMBuilderListener(DOMBuilderListener p0)

Remove DOMBuilderListener

Parameters:
  `p0` - The `DOMBuilderListener` to remove

#### removeDOMBuilderErrorListener

    public void removeDOMBuilderErrorListener(DOMBuilderErrorListener p0)

Remove DOMBuilderErrorListener

Parameters:
  `p0` - The `DOMBuilderErrorListener` to remove

#### getResult

    public Document getResult()

Gets the document

Returns:
  The document being parsed

#### getDoctype

    public DTD getDoctype()

Get the DTD

Returns:
  The `DTD`

#### setDebugMode

    public void setDebugMode(boolean flag)

Sets a flag to turn on debug information in the document

Parameters:
  `flag` - determines whether debug info is stored

#### showWarnings

    public void showWarnings(boolean yes)

Switch to determine whether to print warnings

Parameters:
  `yes` - determines whether warnings should be shown

#### setErrorStream

    public final void setErrorStream(java.io.PrintWriter out)
                              throws java.io.IOException

Creates an output stream for the output of errors and warnings. If an output stream for errors is not specified, the parser will use the standard error output stream `System.err` for outputting errors and warnings.

Parameters:
  `out` - The `PrintWriter` to use for errors and warnings
Throws:
  `java.io.IOException`

#### setErrorStream

    public final void setErrorStream(java.io.OutputStream out)
                              throws java.io.IOException

Creates an output stream for the output of errors and warnings. If an output stream for errors is not specified, the parser will use the standard error output stream `System.err` for outputting errors and warnings.

Parameters:
  `out` - The output stream to use for errors and warnings
Throws:
  `java.io.IOException`

#### setErrorStream

    public final void setErrorStream(java.io.OutputStream out,
                                     java.lang.String enc)
                              throws java.io.IOException

Creates an output stream for the output of errors and warnings. If an output stream for errors is not specified, the parser will use the standard error output stream `System.err` for outputting errors and warnings. Additionally, an .exception is thrown if the encoding specified is unsupported.

Parameters:
  `out` - The output stream to use for errors and warnings
  `enc` - the encoding to use
Throws:
  `java.io.IOException` - if an unsupported encoding is specified

#### getDocument

    public XMLDocument getDocument()

Gets the document

Returns:
  The document being parsed

#### setNodeFactory

    public void setNodeFactory(NodeFactory factory)
                        throws XMLParseException

Set the node factory. Applications can extend the NodeFactory and register it through this method. The parser will then use the user supplied NodeFactory to create nodes of the DOM tree.

Parameters:
  `factory` - The `NodeFactory` to set
Throws:
  `XMLParseException` - if an invalid factory is set
See Also:
  `NodeFactory`

#### setDoctype

    public void setDoctype(DTD dtd)

Set the DTD

Parameters:
  `dtd` - `DTD` to set and used while parsing

#### setValidationMode

    public void setValidationMode(boolean yes)

Set the validation mode

Parameters:
  `yes` - determines whether the XML parser should be validating

#### setBaseURL

    public void setBaseURL(java.net.URL url)

Set the base URL for loading external enitites and DTDs. This method should to be called if the parse(InputStream) is used to parse the XML Document

Parameters:
  `url` - The base URL

#### setPreserveWhitespace

    public void setPreserveWhitespace(boolean flag)

Set the white space preserving mode

Parameters:
  `flag` - preserving mode

#### getValidationMode

    public boolean getValidationMode()

Returns the validation mode

Returns:
  `true` if the XML parser is validating `false` if not

#### getReleaseVersion

    public java.lang.String getReleaseVersion()

Returns the release version of the Oracle XML Parser

Returns:
  the release version string

#### parse

    public final void parse(InputSource in)
                     throws XMLParseException,
                            SAXException,
                            java.io.IOException

Parses the XML from given input source

Parameters:
  `in` - the `org.xml.sax.InputSouce` to parse
Throws:
  `XMLParseException` - if syntax or other error encountered.
  `SAXException` - Any SAX exception, possibly wrapping another exception.
  `java.io.IOException` - IO Error.

#### parse

    public final void parse(java.lang.String in)
                     throws XMLParseException,
                            SAXException,
                            java.io.IOException

Parses the XML from the URL indicated

Parameters:
  `in` - the `String` containing the URL to parse from
Throws:
  `XMLParseException` - if syntax or other error encountered.
  `SAXException` - Any SAX exception, possibly wrapping another exception.
  `java.io.IOException` - IO Error.

#### parse

    public final void parse(java.net.URL url)
                     throws XMLParseException,
                            SAXException,
                            java.io.IOException

Parses the XML document pointed to by the given URL and creates the corresponding XML document hierarchy.

Parameters:
  `url` - the url points to the XML document to parse.
Throws:
  `XMLParseException` - if syntax or other error encountered.
  `SAXException` - Any SAX exception, possibly wrapping another exception.
  `java.io.IOException` - IO Error.

#### parse

    public final void parse(java.io.InputStream in)
                     throws XMLParseException,
                            SAXException,
                            java.io.IOException

Parses the XML from given input stream. The base URL should be set for resolving external entities and DTD.

Parameters:
  `in` - the `InputStream` containing XML data to parse.
Throws:
  `XMLParseException` - if syntax or other error encountered.
  `SAXException` - Any SAX exception, possibly wrapping another exception.
  `java.io.IOException` - IO Error.
See Also:
  `XMLParser.setBaseURL(java.net.URL)`

#### parse

    public final void parse(java.io.Reader r)
                     throws XMLParseException,
                            SAXException,
                            java.io.IOException

Parses the XML from given input stream. The base URL should be set for resolving external entities and DTD.

Parameters:
  `r` - the `Reader` containing XML data to parse.
Throws:
  `XMLParseException` - if syntax or other error encountered.
  `SAXException` - Any SAX exception, possibly wrapping another exception.
  `java.io.IOException` - IO Error.
See Also:
  `XMLParser.setBaseURL(java.net.URL)`

#### parseDTD

    public final void parseDTD(InputSource in,
                               java.lang.String rootName)
                        throws XMLParseException,
                               SAXException,
                               java.io.IOException

Parses the XML External DTD from given input source

Parameters:
  `in` - the `org.xml.sax.InputSouce` to parse
  `rootName` - the element to be used as root Element
Throws:
  `XMLParseException` - if syntax or other error encountered.
  `SAXException` - Any SAX exception, possibly wrapping another exception.
  `java.io.IOException` - IO Error.

#### parseDTD

    public final void parseDTD(java.lang.String in,
                               java.lang.String rootName)
                        throws XMLParseException,
                               SAXException,
                               java.io.IOException

Parses the XML External DTD from the URL indicated

Parameters:
  `in` - the `String` containing the URL to parse from
  `rootName` - the element to be used as root Element
Throws:
  `XMLParseException` - if syntax or other error encountered.
  `SAXException` - Any SAX exception, possibly wrapping another exception.
  `java.io.IOException` - IO Error.

#### parseDTD

    public final void parseDTD(java.net.URL url,
                               java.lang.String rootName)
                        throws XMLParseException,
                               SAXException,
                               java.io.IOException

Parses the XML External DTD document pointed to by the given URL and creates the corresponding XML document hierarchy.

Parameters:
  `url` - the url points to the XML document to parse.
  `rootName` - the element to be used as root Element
Throws:
  `XMLParseException` - if syntax or other error encountered.
  `SAXException` - Any SAX exception, possibly wrapping another exception.
  `java.io.IOException` - IO Error.

#### parseDTD

    public final void parseDTD(java.io.InputStream in,
                               java.lang.String rootName)
                        throws XMLParseException,
                               SAXException,
                               java.io.IOException

Parses the XML External DTD from given input stream. The base URL should be set for resolving external entities and DTD.

Parameters:
  `in` - the `InputStream` containing XML data to parse.
  `rootName` - the element to be used as root Element
Throws:
  `XMLParseException` - if syntax or other error encountered.
  `SAXException` - Any SAX exception, possibly wrapping another exception.
  `java.io.IOException` - IO Error.
See Also:
  `XMLParser.setBaseURL(java.net.URL)`

#### parseDTD

    public final void parseDTD(java.io.Reader r,
                               java.lang.String rootName)
                        throws XMLParseException,
                               SAXException,
                               java.io.IOException

Parses the XML External DTD from given input stream. The base URL should be set for resolving external entities and DTD.

Parameters:
  `r` - the `Reader` containing XML data to parse.
  `rootName` - the element to be used as root Element
Throws:
  `XMLParseException` - if syntax or other error encountered.
  `SAXException` - Any SAX exception, possibly wrapping another exception.
  `java.io.IOException` - IO Error.
See Also:
  `XMLParser.setBaseURL(java.net.URL)`

Copyright © 2003, 2020, Oracle and/or its affiliates.