Enhydra 5.1 API

org.enhydra.xml.io
Class DOMParser

java.lang.Object
  |
  +--javax.xml.parsers.DocumentBuilder
        |
        +--org.enhydra.xml.io.DOMParser

public class DOMParser
extends javax.xml.parsers.DocumentBuilder

XML parser that parsers to a DOM. This implements the JAXP DOM parser interface plus the following additional features:

See Also:
DocumentBuilder

Constructor Summary
DOMParser()
           
 
Method Summary
 java.lang.String getDocumentClassName()
          get the document class for the document to construct.
 DOMImplementation getDOMImplementation()
          Obtain an instance of a DOMImplementation object.
 EntityResolver getEntityResolver()
          Get the EntityResolver
 ErrorHandler getErrorHandler()
          Get the ErrorHandler.
 boolean isNamespaceAware()
          Indicates whether or not this parser is configured to understand namespaces.
 boolean isValidating()
          Indicates whether or not this parser is configured to validate XML documents.
 Document newDocument()
          Obtain a new instance of a DOM Document object to build a DOM tree with.
 Document parse(InputSource is)
          Parse the content of the given input source as an XML document and return a new DOM Document object.
 void setDocumentClassName(java.lang.String className)
          Set the document class for the document to construct.
 void setEntityResolver(EntityResolver er)
          Specify the EntityResolver to be used to resolve entities present in the XML document to be parsed.
 void setErrorHandler(ErrorHandler eh)
          Specify the ErrorHandler to be used handle parse errors.
 void setNamespaceAware(boolean enable)
          Enable or disable namespaces.
 void setValidation(boolean enable)
          Enable or disable validation.
 java.lang.String toString()
          Generate a description of various attributes of the parser for debugging purposes.
 
Methods inherited from class javax.xml.parsers.DocumentBuilder
parse, parse, parse, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DOMParser

public DOMParser()
Method Detail

parse

public Document parse(InputSource is)
               throws SAXException,
                      java.io.IOException
Parse the content of the given input source as an XML document and return a new DOM Document object.

Specified by:
parse in class javax.xml.parsers.DocumentBuilder
Parameters:
is - InputSource containing the content to be parsed.
Returns:
A new DOM Document object.
Throws:
java.io.IOException - If any IO errors occur.
SAXException - If any parse errors occur.
java.lang.IllegalArgumentException - If the InputSource is null
See Also:
DocumentHandler, javax.xml.parsers.DocumentBuilder.parse

setNamespaceAware

public void setNamespaceAware(boolean enable)
Enable or disable namespaces.


isNamespaceAware

public boolean isNamespaceAware()
Indicates whether or not this parser is configured to understand namespaces.

Specified by:
isNamespaceAware in class javax.xml.parsers.DocumentBuilder
Returns:
true if this parser is configured to understand namespaces; false otherwise.
See Also:
javax.xml.parsers.DocumentBuilder.isNamespaceAware

setValidation

public void setValidation(boolean enable)
Enable or disable validation.


isValidating

public boolean isValidating()
Indicates whether or not this parser is configured to validate XML documents.

Specified by:
isValidating in class javax.xml.parsers.DocumentBuilder
Returns:
true if this parser is configured to validate XML documents; false otherwise.
See Also:
javax.xml.parsers.DocumentBuilder.isValidating

setEntityResolver

public void setEntityResolver(EntityResolver er)
Specify the EntityResolver to be used to resolve entities present in the XML document to be parsed. Setting this to null will result in the underlying implementation using it's own default implementation and behavior.

Specified by:
setEntityResolver in class javax.xml.parsers.DocumentBuilder
Parameters:
er - The EntityResolver to be used to resolve entities present in the XML document to be parsed.
See Also:
javax.xml.parsers.DocumentBuilder.setEntityResolver

getEntityResolver

public EntityResolver getEntityResolver()
Get the EntityResolver


setErrorHandler

public void setErrorHandler(ErrorHandler eh)
Specify the ErrorHandler to be used handle parse errors. Setting this to null will result in the underlying implementation using it's own default implementation and behavior.

Specified by:
setErrorHandler in class javax.xml.parsers.DocumentBuilder
Parameters:
eh - The ErrorHandler to be used to report errors present in the XML document to be parsed.
See Also:
javax.xml.parsers.DocumentBuilder.setErrorHandler

getErrorHandler

public ErrorHandler getErrorHandler()
Get the ErrorHandler.


setDocumentClassName

public void setDocumentClassName(java.lang.String className)
Set the document class for the document to construct. FIXME: need by-class object specificaion.


getDocumentClassName

public java.lang.String getDocumentClassName()
get the document class for the document to construct.


newDocument

public Document newDocument()
Obtain a new instance of a DOM Document object to build a DOM tree with.

Specified by:
newDocument in class javax.xml.parsers.DocumentBuilder
Returns:
A new instance of a DOM Document object.
See Also:
javax.xml.parsers.DocumentBuilder.newDocument

getDOMImplementation

public DOMImplementation getDOMImplementation()
Obtain an instance of a DOMImplementation object.

Specified by:
getDOMImplementation in class javax.xml.parsers.DocumentBuilder
Returns:
A new instance of a DOMImplementation.

toString

public java.lang.String toString()
Generate a description of various attributes of the parser for debugging purposes.

Overrides:
toString in class java.lang.Object

Enhydra 5.1 API