Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle® Application Server XML Java API Reference 10g Release 2 (10.1.2) Part no. B12024-03 September 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.xml.parser.v2
Class DOMParser

    java.lang.Object
      |
      +--oracle.xml.parser.v2.XMLParser
            |
            +--oracle.xml.parser.v2.DOMParser

public class DOMParser
extends XMLParser

This class implements an eXtensible Markup Language (XML) 1.0 parser according to the World Wide Web Consortium (W3C) recommendation. to parse a XML document and build a DOM tree.

Field Summary
`static java.lang.String` | `DEBUG_MODE` Sets Debug Mode Boolean.TRUE or Boolean.FALSE
`static java.lang.String` | `ERROR_ENCODING` Encoding for errors report via error stream (only if ERROR_STREAM is set)
`static java.lang.String` | `ERROR_STREAM` Error stream for reporting errors.
`static java.lang.String` | `NODE_FACTORY` Set NodeFactory to build custom Nodes
`static java.lang.String` | `PARTIAL_DOM` Set flag to build partial DOM
`static java.lang.String` | `SHOW_WARNINGS` Boolean to ignore warnings Boolean.TRUE or Boolean.FALSE

Fields inherited from class oracle.xml.parser.v2.XMLParser
`attributes, BASE_URL, DTD_OBJECT, EXPAND_ENTITYREF, PARSER, PARSER_CDATA, PARSER_DTD, SCHEMA_LANGUAGE, SCHEMA_OBJECT, SCHEMA_SOURCE, STANDALONE, USE_DTD_ONLY_FOR_VALIDATION`

Constructor Summary
`DOMParser()` Creates a new parser object.

Method Summary
`java.lang.Object` | `getAttribute(java.lang.String name)` Allows the user to retrieve specific attributes on the underlying implementation.
`DTD` | `getDoctype()` Get the DTD
`XMLDocument` | `getDocument()` Gets the document
`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` | `reset()` Resets the parser state
`void` | `retainCDATASection(boolean flag)` Switch to determine whether to retain CDATA sections
`void` | `setAttribute(java.lang.String name, java.lang.Object value)` Allows the user to set specific attributes on the underlying implementation.
`void` | `setDebugMode(boolean flag)` Sets a flag to turn on debug information in the document
`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` | `showWarnings(boolean flag)` Switch to determine whether to print warnings

Methods inherited from class oracle.xml.parser.v2.XMLParser
`getBaseURL, getEntityResolver, getErrorHandler, getReleaseVersion, getValidationMode, getValidationModeValue, getXMLProperty, isXMLPropertyReadOnly, isXMLPropertySupported, parse, parse, parse, parse, parse, setBaseURL, setDoctype, setEntityResolver, setErrorHandler, setLocale, setPreserveWhitespace, setSchemaValidationMode, setValidationMode, setValidationMode, setXMLProperty, setXMLSchema`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ERROR_STREAM

    public static final java.lang.String ERROR_STREAM

  Error stream for reporting errors. The object can be OutputStream or PrintWriter. This attribute is ignored if ErrorHandler is set.
  See Also:
    Constant Field Values

### ERROR_ENCODING

    public static final java.lang.String ERROR_ENCODING

  Encoding for errors report via error stream (only if ERROR_STREAM is set)
  See Also:
    Constant Field Values

### SHOW_WARNINGS

    public static final java.lang.String SHOW_WARNINGS

  Boolean to ignore warnings Boolean.TRUE or Boolean.FALSE
  See Also:
    Constant Field Values

### DEBUG_MODE

    public static final java.lang.String DEBUG_MODE

  Sets Debug Mode Boolean.TRUE or Boolean.FALSE
  See Also:
    Constant Field Values

### NODE_FACTORY

    public static final java.lang.String NODE_FACTORY

  Set NodeFactory to build custom Nodes
  See Also:
    Constant Field Values

### PARTIAL_DOM

    public static final java.lang.String PARTIAL_DOM

  Set flag to build partial DOM
  See Also:
    Constant Field Values

Constructor Detail

### DOMParser

    public DOMParser()

  Creates a new parser object.

Method Detail

### reset

    public void reset()

  Resets the parser state
  Overrides:
    `reset` in class `XMLParser`

### getDocument

    public XMLDocument getDocument()

  Gets the document
  Returns:
    The document being parsed

### 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` - if I/O error occurs in setting the error stream.

### 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
    `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

### 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`

### getDoctype

    public DTD getDoctype()

  Get the DTD
  Returns:
    The `DTD`

### showWarnings

    public void showWarnings(boolean flag)

  Switch to determine whether to print warnings
  Parameters:
    `flag` - determines whether warnings should be shown

### retainCDATASection

    public void retainCDATASection(boolean flag)

  Switch to determine whether to retain CDATA sections
  Parameters:
    `flag` - TRUE - keep CDATASections (default)
    FALSE - convert CDATASection to Text nodes

### 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

### 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)`

### setAttribute

    public void setAttribute(java.lang.String name,
                             java.lang.Object value)
                      throws java.lang.IllegalArgumentException

  Allows the user to set specific attributes on the underlying implementation.
  Overrides:
    `setAttribute` in class `XMLParser`
  Parameters:
    `name` - The name of the attribute.
    `value` - The value of the attribute.
  Throws:
    `java.lang.IllegalArgumentException` - thrown if the underlying implementation doesn't recognize the attribute.

### getAttribute

    public java.lang.Object getAttribute(java.lang.String name)
                                  throws java.lang.IllegalArgumentException

  Allows the user to retrieve specific attributes on the underlying implementation.
  Overrides:
    `getAttribute` in class `XMLParser`
  Parameters:
    `name` - The name of the attribute.
  Returns:
    value The value of the attribute.
  Throws:
    `java.lang.IllegalArgumentException` - thrown if the underlying implementation doesn't recognize the attribute.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle® Application Server XML Java API Reference 10g Release 2 (10.1.2) Part no. B12024-03 September 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003, 2004, Oracle. All rights reserved.