com.mkdoc.sax
Class AbstractXMLReader

java.lang.Object
  |
  +--com.mkdoc.sax.AbstractXMLReader
All Implemented Interfaces:
org.xml.sax.XMLReader
Direct Known Subclasses:
UKIarReader

public abstract class AbstractXMLReader
extends java.lang.Object
implements org.xml.sax.XMLReader

A base class for custom XML readers.

Subclasses should initialise the feature set with the mandatory features for XML namespace and namespace prefix support, which must be mutable.

    features.put(NAMESPACES,
                 new Feature());

    features.put(PREFIXES,
                 new Feature());
  

Version:
0.2 2004-10-25
Author:
Philip Shaw

Nested Class Summary
protected  class AbstractXMLReader.Feature
          SAX parser feature.
protected  class AbstractXMLReader.Property
          SAX parser property.
 
Field Summary
protected  org.xml.sax.ContentHandler contHandler
          A content handler.
protected  org.xml.sax.DTDHandler dtdHandler
          A DTD handler.
protected  org.xml.sax.ErrorHandler errorHandler
          An error handler.
protected  java.util.Map features
          A set of XML parser features.
static java.lang.String NAMESPACES
          The XML namespaces feature identifier.
static java.lang.String PREFIXES
          The XML namespace prefixes feature identifier.
protected  java.util.Map properties
          A set of XML parser properties.
protected  org.xml.sax.EntityResolver resolver
          An entity resolver.
 
Constructor Summary
AbstractXMLReader()
           
 
Method Summary
 org.xml.sax.ContentHandler getContentHandler()
          Get the content handler.
 org.xml.sax.DTDHandler getDTDHandler()
          Get the DTD handler.
 org.xml.sax.EntityResolver getEntityResolver()
          Get the entity resolver.
 org.xml.sax.ErrorHandler getErrorHandler()
          Get the error handler.
 boolean getFeature(java.lang.String name)
          Get a parser feature.
 java.lang.Object getProperty(java.lang.String name)
          Get a parser property.
 void parse(java.lang.String systemId)
          Parse input from a system ID.
 void setContentHandler(org.xml.sax.ContentHandler handler)
          Set a content handler.
 void setDTDHandler(org.xml.sax.DTDHandler handler)
          Set a DTD handler.
 void setEntityResolver(org.xml.sax.EntityResolver resolver)
          Set an entity resolver.
 void setErrorHandler(org.xml.sax.ErrorHandler handler)
          Set an error handler.
 void setFeature(java.lang.String name, boolean value)
          Set a parser feature.
 void setProperty(java.lang.String name, java.lang.Object value)
          Set a parser property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.XMLReader
parse
 

Field Detail

NAMESPACES

public static final java.lang.String NAMESPACES
The XML namespaces feature identifier.

Since:
Version 0.1 2004-10-25
See Also:
Constant Field Values

PREFIXES

public static final java.lang.String PREFIXES
The XML namespace prefixes feature identifier.

Since:
Version 0.1 2004-10-25
See Also:
Constant Field Values

features

protected java.util.Map features
A set of XML parser features.

Since:
Version 0.1 2004-10-20

properties

protected java.util.Map properties
A set of XML parser properties.

Since:
Version 0.2 2004-10-25

resolver

protected org.xml.sax.EntityResolver resolver
An entity resolver.

Since:
Version 0.2 2004-10-25

dtdHandler

protected org.xml.sax.DTDHandler dtdHandler
A DTD handler.

Since:
Version 0.2 2004-10-25

contHandler

protected org.xml.sax.ContentHandler contHandler
A content handler.

Since:
Version 0.2 2004-10-25

errorHandler

protected org.xml.sax.ErrorHandler errorHandler
An error handler.

Since:
Version 0.2 2004-10-25
Constructor Detail

AbstractXMLReader

public AbstractXMLReader()
Method Detail

getFeature

public final boolean getFeature(java.lang.String name)
                         throws org.xml.sax.SAXNotRecognizedException,
                                org.xml.sax.SAXNotSupportedException
Get a parser feature.

Specified by:
getFeature in interface org.xml.sax.XMLReader
Parameters:
name - A SAX parser feature name specified by a fully qualified URI.
Returns:
The value of the named feature property.
Throws:
org.xml.sax.SAXNotRecognizedException - If the feature name is not recognised.
org.xml.sax.SAXNotSupportedException - If the named feature is not supported.
Since:
Version 0.1 2004-10-20

setFeature

public final void setFeature(java.lang.String name,
                             boolean value)
                      throws org.xml.sax.SAXNotRecognizedException,
                             org.xml.sax.SAXNotSupportedException
Set a parser feature.

Specified by:
setFeature in interface org.xml.sax.XMLReader
Parameters:
name - A SAX parser feature name specified by a fully qualified URI.
value - The setting to be assigned to the named property.
Throws:
org.xml.sax.SAXNotRecognizedException - If the feature name is not recognised.
org.xml.sax.SAXNotSupportedException - If the named feature is not supported.
Since:
Version 0.1 2004-10-20

getProperty

public final java.lang.Object getProperty(java.lang.String name)
                                   throws org.xml.sax.SAXNotRecognizedException,
                                          org.xml.sax.SAXNotSupportedException
Get a parser property.

Specified by:
getProperty in interface org.xml.sax.XMLReader
Parameters:
name - A SAX parser property name specified by a fully qualified URI.
Returns:
The value of the named parser property.
Throws:
org.xml.sax.SAXNotRecognizedException - If the property name is not recognised.
org.xml.sax.SAXNotSupportedException - If the named property is not supported.
Since:
Version 0.2 2004-10-25

setProperty

public final void setProperty(java.lang.String name,
                              java.lang.Object value)
                       throws org.xml.sax.SAXNotRecognizedException,
                              org.xml.sax.SAXNotSupportedException
Set a parser property.

Specified by:
setProperty in interface org.xml.sax.XMLReader
Parameters:
name - A SAX parser property name specified by a fully qualified URI.
value - The setting to be assigned to the named property.
Throws:
org.xml.sax.SAXNotRecognizedException - If the property name is not recognised.
org.xml.sax.SAXNotSupportedException - If the named property is not supported.
Since:
Version 0.2 2004-10-25

setEntityResolver

public final void setEntityResolver(org.xml.sax.EntityResolver resolver)
Set an entity resolver.

Specified by:
setEntityResolver in interface org.xml.sax.XMLReader
Parameters:
resolver - An EntityResolver to be used when parsing input.
Since:
Version 0.2 2004-10-25

getEntityResolver

public final org.xml.sax.EntityResolver getEntityResolver()
Get the entity resolver.

Specified by:
getEntityResolver in interface org.xml.sax.XMLReader
Returns:
The current EntityResolver, or null if not set.
Since:
Version 0.2 2004-10-25

setDTDHandler

public final void setDTDHandler(org.xml.sax.DTDHandler handler)
Set a DTD handler.

Specified by:
setDTDHandler in interface org.xml.sax.XMLReader
Parameters:
handler - A DTDHandler to be used when parsing input.
Since:
Version 0.2 2004-10-25

getDTDHandler

public final org.xml.sax.DTDHandler getDTDHandler()
Get the DTD handler.

Specified by:
getDTDHandler in interface org.xml.sax.XMLReader
Returns:
The current DTDHandler, or null if not set.
Since:
Version 0.2 2004-10-25

setContentHandler

public final void setContentHandler(org.xml.sax.ContentHandler handler)
Set a content handler.

Specified by:
setContentHandler in interface org.xml.sax.XMLReader
Parameters:
handler - A ContentHandler to be used when parsing input.
Since:
Version 0.2 2004-10-25

getContentHandler

public final org.xml.sax.ContentHandler getContentHandler()
Get the content handler.

Specified by:
getContentHandler in interface org.xml.sax.XMLReader
Returns:
The current ContentHandler, or null if not set.
Since:
Version 0.2 2004-10-25

setErrorHandler

public final void setErrorHandler(org.xml.sax.ErrorHandler handler)
Set an error handler.

Specified by:
setErrorHandler in interface org.xml.sax.XMLReader
Parameters:
handler - An ErrorHandler to be used when parsing input.
Since:
Version 0.2 2004-10-25

getErrorHandler

public final org.xml.sax.ErrorHandler getErrorHandler()
Get the error handler.

Specified by:
getErrorHandler in interface org.xml.sax.XMLReader
Returns:
The current ErrorHandler, or null if not set.
Since:
Version 0.2 2004-10-25

parse

public final void parse(java.lang.String systemId)
                 throws java.io.IOException,
                        org.xml.sax.SAXException
Parse input from a system ID.

Specified by:
parse in interface org.xml.sax.XMLReader
Parameters:
systemId - A reference to the source to parse.
Throws:
java.io.IOException - If there is a problem reading the input source.
org.xml.sax.SAXException - If an error occurs parsing the input.
Since:
Version 0.2 2004-10-25