org.simBio.serialize.xml
Class LogSax2

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.xml.sax.ext.DefaultHandler2
          extended by org.simBio.serialize.xml.LogSax2
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, DeclHandler, EntityResolver2, LexicalHandler
Direct Known Subclasses:
TocReader

public class LogSax2
extends DefaultHandler2

Logging SAX2 events.

Version:
$Id: LogSax2.java,v 1.3 2006/12/07 02:11:28 nsarai Exp $
Author:
Nobuaki Sarai

Constructor Summary
LogSax2()
           
 
Method Summary
 void attributeDecl(String eName, String aName, String type, String mode, String value)
          Logs attribute details of elements when debugging.
 void characters(char[] ch, int start, int length)
          Logs character data when debugging.
 void comment(char[] ch, int start, int length)
          Logs comments when debugging.
 void elementDecl(String name, String model)
          Logs element names and models when debugging
 void endCDATA()
          Logs the end of a CDATA section.
 void endDocument()
          Reports the end of the document.
 void endDTD()
          Logs the end of a DTD section.
 void endElement(String uri, String localName, String qName)
          Reports the end of an element.
 void endEntity(String name)
          Logs the end of an entity.
 void endPrefixMapping(String prefix)
          Reports the end of a prefix-URI mapping.
 void externalEntityDecl(String name, String publicId, String systemId)
          Logs a parsed external entity declaration.
 InputSource getExternalSubset(String name, String baseURI)
          Returns and logs a new external subset.
 void ignorableWhitespace(char[] ch, int start, int length)
          Reports ignorable whitespace in element content.
 void internalEntityDecl(String name, String value)
          Logs an internal entity declaration
 void notationDecl(String name, String publicId, String systemId)
          Reports notation declaration.
 void processingInstruction(String target, String data)
          Reports processing instruction.
 InputSource resolveEntity(String publicId, String systemId)
          Calls the EntityResolver2 resolveEntity method.
 InputSource resolveEntity(String name, String publicId, String baseURI, String systemId)
          Maps references to external entities into input sources.
 void setDocumentLocator(Locator locator)
          ClassCastException is thrown by IBMJDK142 + Xerces-J causes for Locator2 Sun J2SDK1.4.1 + Xerces-J or Sun J2SE5.0 is OK.
 void skippedEntity(String name)
          Reports a skipped entity.
 void startCDATA()
          Reports the start of a CDATA section.
 void startDocument()
          Reports the beginning of a document.
 void startDTD(String name, String publicId, String systemId)
          Reports the start of a DTD declaration.
 void startElement(String uri, String localName, String qName, Attributes attributes)
          Reports the start of an element.
 void startEntity(String name)
          Reports the start of some XML entities.
 void startPrefixMapping(String prefix, String uri)
          Begin scope of prefix-URI mapping.
 void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
          Receives notification of an unparsed entity declaration
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogSax2

public LogSax2()
Method Detail

characters

public void characters(char[] ch,
                       int start,
                       int length)
Logs character data when debugging.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
See Also:
ContentHandler.characters(char[], int, int)

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
Logs comments when debugging.

Specified by:
comment in interface LexicalHandler
Overrides:
comment in class DefaultHandler2
Throws:
SAXException
See Also:
LexicalHandler.comment(char[], int, int)

endDocument

public void endDocument()
                 throws SAXException
Reports the end of the document.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler
Throws:
SAXException
See Also:
ContentHandler.endDocument()

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Reports the end of an element.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Throws:
SAXException
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
Reports ignorable whitespace in element content.

Specified by:
ignorableWhitespace in interface ContentHandler
Overrides:
ignorableWhitespace in class DefaultHandler
See Also:
ContentHandler.ignorableWhitespace(char[], int, int)

notationDecl

public void notationDecl(String name,
                         String publicId,
                         String systemId)
Reports notation declaration.

Specified by:
notationDecl in interface DTDHandler
Overrides:
notationDecl in class DefaultHandler
See Also:
DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)

processingInstruction

public void processingInstruction(String target,
                                  String data)
Reports processing instruction.

Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in class DefaultHandler
See Also:
ContentHandler.processingInstruction(java.lang.String, java.lang.String)

setDocumentLocator

public void setDocumentLocator(Locator locator)
ClassCastException is thrown by IBMJDK142 + Xerces-J causes for Locator2 Sun J2SDK1.4.1 + Xerces-J or Sun J2SE5.0 is OK. Thus, when Locator2 can not be resolved, encoding is set to UTF-8 by default.

Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class DefaultHandler
See Also:
ContentHandler.setDocumentLocator(org.xml.sax.Locator)

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
Reports the start of an element.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Throws:
SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

startDocument

public void startDocument()
Reports the beginning of a document.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class DefaultHandler
See Also:
ContentHandler.startDocument()

unparsedEntityDecl

public void unparsedEntityDecl(String name,
                               String publicId,
                               String systemId,
                               String notationName)
Receives notification of an unparsed entity declaration

Specified by:
unparsedEntityDecl in interface DTDHandler
Overrides:
unparsedEntityDecl in class DefaultHandler
See Also:
DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

attributeDecl

public void attributeDecl(String eName,
                          String aName,
                          String type,
                          String mode,
                          String value)
                   throws SAXException
Logs attribute details of elements when debugging.

Specified by:
attributeDecl in interface DeclHandler
Overrides:
attributeDecl in class DefaultHandler2
Throws:
SAXException
See Also:
DeclHandler.attributeDecl(String, String, String, String, String)

elementDecl

public void elementDecl(String name,
                        String model)
                 throws SAXException
Logs element names and models when debugging

Specified by:
elementDecl in interface DeclHandler
Overrides:
elementDecl in class DefaultHandler2
Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Logs the end of a CDATA section.

Specified by:
endCDATA in interface LexicalHandler
Overrides:
endCDATA in class DefaultHandler2
Throws:
SAXException
See Also:
LexicalHandler.endCDATA()

endDTD

public void endDTD()
            throws SAXException
Logs the end of a DTD section.

Specified by:
endDTD in interface LexicalHandler
Overrides:
endDTD in class DefaultHandler2
Throws:
SAXException
See Also:
LexicalHandler.endDTD()

endEntity

public void endEntity(String name)
               throws SAXException
Logs the end of an entity.

Specified by:
endEntity in interface LexicalHandler
Overrides:
endEntity in class DefaultHandler2
Throws:
SAXException
See Also:
LexicalHandler.endEntity(String)

externalEntityDecl

public void externalEntityDecl(String name,
                               String publicId,
                               String systemId)
                        throws SAXException
Logs a parsed external entity declaration.

Specified by:
externalEntityDecl in interface DeclHandler
Overrides:
externalEntityDecl in class DefaultHandler2
Throws:
SAXException
See Also:
DeclHandler.externalEntityDecl(String, String, String)

getExternalSubset

public InputSource getExternalSubset(String name,
                                     String baseURI)
                              throws SAXException,
                                     IOException
Returns and logs a new external subset.

Specified by:
getExternalSubset in interface EntityResolver2
Overrides:
getExternalSubset in class DefaultHandler2
Returns:
input source for new external subset to be used by parser, or null
Throws:
SAXException
IOException
See Also:
EntityResolver2.getExternalSubset(String, String)

internalEntityDecl

public void internalEntityDecl(String name,
                               String value)
                        throws SAXException
Logs an internal entity declaration

Specified by:
internalEntityDecl in interface DeclHandler
Overrides:
internalEntityDecl in class DefaultHandler2
Throws:
SAXException
See Also:
DeclHandler.internalEntityDecl(String, String)

resolveEntity

public InputSource resolveEntity(String name,
                                 String publicId,
                                 String baseURI,
                                 String systemId)
                          throws SAXException,
                                 IOException
Maps references to external entities into input sources.

Specified by:
resolveEntity in interface EntityResolver2
Overrides:
resolveEntity in class DefaultHandler2
Returns:
an input source or null
Throws:
SAXException
IOException
See Also:
EntityResolver2.resolveEntity(String, String, String, String)

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws SAXException,
                                 IOException
Calls the EntityResolver2 resolveEntity method.

Specified by:
resolveEntity in interface EntityResolver
Overrides:
resolveEntity in class DefaultHandler2
Returns:
an input source or null
Throws:
SAXException
IOException
See Also:
EntityResolver.resolveEntity(String, String)

startCDATA

public void startCDATA()
                throws SAXException
Reports the start of a CDATA section.

Specified by:
startCDATA in interface LexicalHandler
Overrides:
startCDATA in class DefaultHandler2
Throws:
SAXException
See Also:
LexicalHandler.startCDATA()

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
Reports the start of a DTD declaration.

Specified by:
startDTD in interface LexicalHandler
Overrides:
startDTD in class DefaultHandler2
Throws:
SAXException
See Also:
LexicalHandler.startDTD(String, String, String)

startEntity

public void startEntity(String name)
                 throws SAXException
Reports the start of some XML entities.

Specified by:
startEntity in interface LexicalHandler
Overrides:
startEntity in class DefaultHandler2
Throws:
SAXException
See Also:
LexicalHandler.startEntity(String)

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Reports the end of a prefix-URI mapping.

Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class DefaultHandler
Throws:
SAXException
See Also:
ContentHandler.endPrefixMapping(String)

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Reports a skipped entity.

Specified by:
skippedEntity in interface ContentHandler
Overrides:
skippedEntity in class DefaultHandler
Throws:
SAXException
See Also:
ContentHandler.skippedEntity(String)

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Begin scope of prefix-URI mapping.

Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class DefaultHandler
Throws:
SAXException
See Also:
ContentHandler.startPrefixMapping(String, String)


Copyright © 2005 Cell/Biodinamics simulation project. All Rights Reserved.