org.brains2b.saxo
Class SAXReader

java.lang.Object
  extended byorg.brains2b.saxo.SAXReader
All Implemented Interfaces:
org.xml.sax.XMLReader

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

Partial implementation for SAX 2 Parser This is a first version of the SAX 2 Parser, ContentHandler only.

It is written for to be small, fast and SAX 2 compliant.

Other Parsers will all be stronger in one of these areas, so if you need only one: small, speed or SAX 2 compliant you can probably do better.

Version:
0.20 [09-01-2006]
Author:
dennis

Nested Class Summary
protected  class SAXReader.Position
          an inner class to track the position within the document with.
 
Field Summary
protected static int INTERNAL
           
protected  java.lang.String m_doc
           
protected  int m_docType
           
protected static int SYSTEM
           
 
Constructor Summary
SAXReader()
           
 
Method Summary
 org.xml.sax.ContentHandler getContentHandler()
          get the content handler for this parser
 org.xml.sax.DTDHandler getDTDHandler()
          get the dtd for this parser
 org.xml.sax.EntityResolver getEntityResolver()
          get the entity resolver for this parser
 org.xml.sax.ErrorHandler getErrorHandler()
           
 boolean getFeature(java.lang.String name)
           
protected  SAXReader.Position getPosition()
          return the current position of the reader within the document Easiest way to use is just call toString() on position to have a printable format for the position
 java.lang.Object getProperty(java.lang.String name)
           
 void parse(org.xml.sax.InputSource is)
          Main parse function
 void parse(java.lang.String fileName)
          Main parse function
 void setContentHandler(org.xml.sax.ContentHandler handler)
          set the ContentHandler.
 void setDTDHandler(org.xml.sax.DTDHandler dtd)
          sets the DTD Handler (this option is not implemented yet)
 void setEntityResolver(org.xml.sax.EntityResolver resolver)
          sets the EntityResolver (this option is not implemented yet)
 void setErrorHandler(org.xml.sax.ErrorHandler e_handler)
          set the ErrorHandler (this option is not implemented yet)
 void setFeature(java.lang.String name, boolean value)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM

protected static final int SYSTEM
See Also:
Constant Field Values

INTERNAL

protected static final int INTERNAL
See Also:
Constant Field Values

m_docType

protected int m_docType

m_doc

protected java.lang.String m_doc
Constructor Detail

SAXReader

public SAXReader()
Method Detail

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)
sets the EntityResolver (this option is not implemented yet)

Specified by:
setEntityResolver in interface org.xml.sax.XMLReader
See Also:
XMLReader.setEntityResolver(EntityResolver)

setDTDHandler

public void setDTDHandler(org.xml.sax.DTDHandler dtd)
sets the DTD Handler (this option is not implemented yet)

Specified by:
setDTDHandler in interface org.xml.sax.XMLReader
See Also:
XMLReader.setDTDHandler(DTDHandler)

setContentHandler

public void setContentHandler(org.xml.sax.ContentHandler handler)
set the ContentHandler. The methods in this interface can be called through this parser

Specified by:
setContentHandler in interface org.xml.sax.XMLReader
Since:
Saxo 0.20
See Also:
XMLReader.setContentHandler(ContentHandler)

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler e_handler)
set the ErrorHandler (this option is not implemented yet)

Specified by:
setErrorHandler in interface org.xml.sax.XMLReader
See Also:
XMLReader.setErrorHandler(ErrorHandler)

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
Specified by:
getErrorHandler in interface org.xml.sax.XMLReader

parse

public void parse(org.xml.sax.InputSource is)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Main parse function

Specified by:
parse in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXException
java.io.IOException
See Also:
XMLReader.parse(InputSource)

parse

public void parse(java.lang.String fileName)
           throws org.xml.sax.SAXException,
                  java.io.IOException
Main parse function

Specified by:
parse in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXException
java.io.IOException
See Also:
XMLReader.parse(String)

getPosition

protected SAXReader.Position getPosition()
return the current position of the reader within the document

Easiest way to use is just call toString() on position to have a printable format for the position

Returns:
SAXParser.Position
See Also:
SAXReader.Position

getContentHandler

public org.xml.sax.ContentHandler getContentHandler()
get the content handler for this parser

Specified by:
getContentHandler in interface org.xml.sax.XMLReader
Since:
Saxo 0.20

getDTDHandler

public org.xml.sax.DTDHandler getDTDHandler()
get the dtd for this parser

Specified by:
getDTDHandler in interface org.xml.sax.XMLReader
Since:
Saxo 0.20

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
get the entity resolver for this parser

Specified by:
getEntityResolver in interface org.xml.sax.XMLReader
Since:
Saxo 0.20

getFeature

public boolean getFeature(java.lang.String name)
                   throws org.xml.sax.SAXNotRecognizedException,
                          org.xml.sax.SAXNotSupportedException
Specified by:
getFeature in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

getProperty

public java.lang.Object getProperty(java.lang.String name)
                             throws org.xml.sax.SAXNotRecognizedException,
                                    org.xml.sax.SAXNotSupportedException
Specified by:
getProperty in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws org.xml.sax.SAXNotRecognizedException,
                       org.xml.sax.SAXNotSupportedException
Specified by:
setFeature in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
                 throws org.xml.sax.SAXNotRecognizedException,
                        org.xml.sax.SAXNotSupportedException
Specified by:
setProperty in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException