org.randomcoder.xml
Class AbstractXMLReader

java.lang.Object
  extended by org.randomcoder.xml.AbstractXMLReader
All Implemented Interfaces:
XMLReader
Direct Known Subclasses:
TextReader

public abstract class AbstractXMLReader
extends Object
implements XMLReader

Abstract base class for XMLReader implementations.

 Copyright (c) 2006-2007, Craig Condit. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 
   * Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice,
     this list of conditions and the following disclaimer in the documentation
     and/or other materials provided with the distribution.
     
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.
 


Constructor Summary
AbstractXMLReader()
           
 
Method Summary
 ContentHandler getContentHandler()
          Gets the content handler defined for this reader.
 DTDHandler getDTDHandler()
          Gets the DTD handler for this reader.
 EntityResolver getEntityResolver()
          Gets the entity resolver for this reader.
 ErrorHandler getErrorHandler()
          Gets the error handler for this reader.
 boolean getFeature(String name)
          Determines if this reader supports the given feature.
 Object getProperty(String name)
          Gets the value of the named property.
abstract  void parse(InputSource input)
          Parses the given input source.
 void parse(String systemId)
          Parses a document using the given system id.
 void setContentHandler(ContentHandler contentHandler)
          Sets the content handler for this reader.
 void setDTDHandler(DTDHandler dtdHandler)
          Sets the DTD handler for this reader.
 void setEntityResolver(EntityResolver entityResolver)
          Sets the entity resolver for this reader.
 void setErrorHandler(ErrorHandler errorHandler)
          Sets the error handler for this reader.
 void setFeature(String name, boolean value)
          Sets the availability of the given feature.
 void setProperty(String name, Object value)
          Sets the value o fthe named property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractXMLReader

public AbstractXMLReader()
Method Detail

parse

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

Subclasses must implement this method to handle XML parsing.

Specified by:
parse in interface XMLReader
Parameters:
input - input source to parse
Throws:
IOException - if resource cannot be read
SAXException - if an error occurs
See Also:
XMLReader.parse(InputSource)

parse

public void parse(String systemId)
           throws IOException,
                  SAXException
Parses a document using the given system id.

Specified by:
parse in interface XMLReader
Parameters:
systemId - system id
Throws:
IOException - if resource cannot be read
SAXException - if an error occurs

getContentHandler

public ContentHandler getContentHandler()
Gets the content handler defined for this reader.

Specified by:
getContentHandler in interface XMLReader
Returns:
content handler

setContentHandler

public void setContentHandler(ContentHandler contentHandler)
Sets the content handler for this reader.

Specified by:
setContentHandler in interface XMLReader
Parameters:
contentHandler - content handler

getDTDHandler

public DTDHandler getDTDHandler()
Gets the DTD handler for this reader.

Specified by:
getDTDHandler in interface XMLReader
Returns:
DTD handler

setDTDHandler

public void setDTDHandler(DTDHandler dtdHandler)
Sets the DTD handler for this reader.

Specified by:
setDTDHandler in interface XMLReader
Parameters:
dtdHandler - DTD handler

getEntityResolver

public EntityResolver getEntityResolver()
Gets the entity resolver for this reader.

Specified by:
getEntityResolver in interface XMLReader
Returns:
entity resolver

setEntityResolver

public void setEntityResolver(EntityResolver entityResolver)
Sets the entity resolver for this reader.

Specified by:
setEntityResolver in interface XMLReader
Parameters:
entityResolver - entity resolver

getErrorHandler

public ErrorHandler getErrorHandler()
Gets the error handler for this reader.

Specified by:
getErrorHandler in interface XMLReader
Returns:
error handler

setErrorHandler

public void setErrorHandler(ErrorHandler errorHandler)
Sets the error handler for this reader.

Specified by:
setErrorHandler in interface XMLReader
Parameters:
errorHandler - error handler

getFeature

public boolean getFeature(String name)
                   throws SAXNotRecognizedException,
                          SAXNotSupportedException
Determines if this reader supports the given feature.

Specified by:
getFeature in interface XMLReader
Parameters:
name - feature name
Returns:
true if feature is available, false otherwise
Throws:
SAXNotRecognizedException - if the feature is not recognized
SAXNotSupportedException - if the method is not supported

setFeature

public void setFeature(String name,
                       boolean value)
                throws SAXNotRecognizedException,
                       SAXNotSupportedException
Sets the availability of the given feature.

Specified by:
setFeature in interface XMLReader
Parameters:
name - feature name
value - true if enabled, false otherwise
Throws:
SAXNotRecognizedException - if the feature is not recognized
SAXNotSupportedException - if the method is not supported

getProperty

public Object getProperty(String name)
                   throws SAXNotRecognizedException,
                          SAXNotSupportedException
Gets the value of the named property.

Specified by:
getProperty in interface XMLReader
Parameters:
name - property name
Returns:
property value
Throws:
SAXNotRecognizedException - if the property is not recognized
SAXNotSupportedException - if the method is not supported

setProperty

public void setProperty(String name,
                        Object value)
                 throws SAXNotRecognizedException,
                        SAXNotSupportedException
Sets the value o fthe named property.

Specified by:
setProperty in interface XMLReader
Parameters:
name - property name
value - property value
Throws:
SAXNotRecognizedException - if the property is not recognized
SAXNotSupportedException - if the method is not supported


Copyright © 2006-2010 Craig Condit. All Rights Reserved.