org.apache.oodt.commons.util
Class DOMParser

java.lang.Object
  extended by org.apache.oodt.commons.util.DOMParser

public class DOMParser
extends Object

An XML Document Object Model parser. Objects of this class are DOM parsers.

Author:
Kelly

Method Summary
 Document getDocument()
          Get the document.
 EntityResolver getEntityResolver()
          Return the current entity resolver.
 ErrorHandler getErrorHandler()
          Return the current error handler.
 boolean getFeature(String featureId)
          Query the current state of any feature in a SAX2 parser.
 String[] getFeaturesRecognized()
          Returns a list of features that this parser recognizes.
 Locator getLocator()
          return the locator being used by the parser
 String[] getPropertiesRecognized()
          Returns a list of properties that this parser recognizes.
 Object getProperty(String propertyId)
          Return the current value of a property in a SAX2 parser.
 boolean isFeatureRecognized(String featureId)
          Returns true if the specified feature is recognized.
 boolean isPropertyRecognized(String propertyId)
          Returns true if the specified property is recognized.
 void parse(InputSource source)
          Parses the specified input source.
 void parse(String systemID)
          Parses the input source specified by the given system identifier.
 void reset()
          Resets the parser.
 void resetOrCopy()
          Resets or copies the parser.
 void setEntityResolver(EntityResolver resolver)
          Sets the resolver used to resolve external entities.
 void setErrorHandler(ErrorHandler handler)
          Sets the error handler.
 void setFeature(String featureId, boolean state)
          Set the state of any feature in a SAX2 parser.
 void setLocale(Locale locale)
          Set the locale to use for messages.
 void setProperty(String propertyId, Object value)
          Set the value of any property in a SAX2 parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDocument

public Document getDocument()
Get the document.

Returns:
The document.

getFeaturesRecognized

public String[] getFeaturesRecognized()
Returns a list of features that this parser recognizes. This method will never return null; if no features are recognized, this method will return a zero length array.

Returns:
Recognized features.

getPropertiesRecognized

public String[] getPropertiesRecognized()
Returns a list of properties that this parser recognizes. This method will never return null; if no properties are recognized, this method will return a zero length array.

Returns:
Recognized properties.

reset

public void reset()
           throws Exception
Resets the parser.

Throws:
Exception

resetOrCopy

public void resetOrCopy()
                 throws Exception
Resets or copies the parser.

Throws:
Exception

setFeature

public void setFeature(String featureId,
                       boolean state)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
Set the state of any feature in a SAX2 parser. The parser might not recognize the feature, and if it does recognize it, it might not be able to fulfill the request.

Parameters:
featureId - The unique identifier (URI) of the feature.
state - The requested state of the feature (true or false).
Throws:
SAXNotRecognizedException - If the requested feature is not known.
SAXNotSupportedException - If the requested feature is known, but the requested state is not supported.

getFeature

public boolean getFeature(String featureId)
                   throws SAXNotRecognizedException,
                          SAXNotSupportedException
Query the current state of any feature in a SAX2 parser. The parser might not recognize the feature.

Parameters:
featureId - The unique identifier (URI) of the feature being set.
Returns:
The current state of the feature.
Throws:
SAXNotRecognizedException - If the requested feature is not known.
SAXNotSupportedException

setProperty

public void setProperty(String propertyId,
                        Object value)
                 throws SAXNotRecognizedException,
                        SAXNotSupportedException
Set the value of any property in a SAX2 parser. The parser might not recognize the property, and if it does recognize it, it might not support the requested value.

Parameters:
propertyId - The unique identifier (URI) of the property being set.
value - The value to which the property is being set.
Throws:
SAXNotRecognizedException - If the requested property is not known.
SAXNotSupportedException - If the requested property is known, but the requested value is not supported.

getProperty

public Object getProperty(String propertyId)
                   throws SAXNotRecognizedException,
                          SAXNotSupportedException
Return the current value of a property in a SAX2 parser. The parser might not recognize the property.

Parameters:
propertyId - The unique identifier (URI) of the property being set.
Returns:
The current value of the property.
Throws:
SAXNotRecognizedException - If the requested property is not known.
SAXNotSupportedException

isFeatureRecognized

public boolean isFeatureRecognized(String featureId)
Returns true if the specified feature is recognized.


isPropertyRecognized

public boolean isPropertyRecognized(String propertyId)
Returns true if the specified property is recognized.


getLocator

public final Locator getLocator()
return the locator being used by the parser

Returns:
the parser's active locator

setEntityResolver

public void setEntityResolver(EntityResolver resolver)
Sets the resolver used to resolve external entities. The EntityResolver interface supports resolution of public and system identifiers.

Parameters:
resolver - The new entity resolver. Passing a null value will uninstall the currently installed resolver.

getEntityResolver

public EntityResolver getEntityResolver()
Return the current entity resolver.

Returns:
The current entity resolver, or null if none has been registered.
See Also:
setEntityResolver(org.xml.sax.EntityResolver)

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
Sets the error handler.

Parameters:
handler - The new error handler.

getErrorHandler

public ErrorHandler getErrorHandler()
Return the current error handler.

Returns:
The current error handler, or null if none has been registered.
See Also:
setErrorHandler(org.xml.sax.ErrorHandler)

parse

public void parse(InputSource source)
           throws SAXException,
                  IOException
Parses the specified input source.

Parameters:
source - The input source.
Throws:
SAXException - Throws exception on SAX error.
IOException - Throws exception on i/o error.

parse

public void parse(String systemID)
           throws SAXException,
                  IOException
Parses the input source specified by the given system identifier.

This method is equivalent to the following:

     parse(new InputSource(systemId));
 

Parameters:
systemID - The input source.
Throws:
SAXException - Throws exception on SAX error.
IOException - Throws exception on i/o error.

setLocale

public void setLocale(Locale locale)
               throws SAXException
Set the locale to use for messages.

Parameters:
locale - The locale object to use for localization of messages.
Throws:
SAXException - An exception thrown if the parser does not support the specified locale.


Copyright © 1999-2013
Apache OODT. All Rights Reserved.