net.sourceforge.pavlov.library
Class BookXMLHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by net.sourceforge.pavlov.library.BookXMLHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public final class BookXMLHandler
extends DefaultHandler

Implementation of Sax's DefaultHandler for Book XML files

See Also:
ContentHandler, DefaultHandler

Constructor Summary
BookXMLHandler()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Called when sax reads characters that are not start or end tags.
 void endDocument()
          Called when sax ends reading the file.
 void endElement(String namespaceURI, String localName, String qName)
          Called when an END tag is found.
 Book getBook()
          Returns the loaded book.
 void startDocument()
          Called when sax starts reading the file.
 void startElement(String namespaceURI, String localName, String qName, Attributes attr)
          Called when a start tag is found.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BookXMLHandler

public BookXMLHandler()
Method Detail

startDocument

public void startDocument()
                   throws SAXException
Called when sax starts reading the file.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class DefaultHandler
Throws:
SAXException - if an error occurs

endDocument

public void endDocument()
                 throws SAXException
Called when sax ends reading the file.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler
Throws:
SAXException - if an error occurs

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes attr)
                  throws SAXException
Called when a start tag is found.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Parameters:
namespaceURI - a String value
localName - a String value
qName - a String value
attr - an Attributes value
Throws:
SAXException - if an error occurs

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Called when an END tag is found.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Parameters:
namespaceURI - a String value
localName - a String value
qName - a String value
Throws:
SAXException - if an error occurs

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Called when sax reads characters that are not start or end tags.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Parameters:
ch - a char[] value
start - an int value
length - an int value
Throws:
SAXException - if an error occurs

getBook

public Book getBook()
Returns the loaded book.

Returns:
a Book value