net.sf.cantina.util
Class SAXDefaultHandler

java.lang.Object
  extended byorg.xml.sax.helpers.DefaultHandler
      extended bynet.sf.cantina.util.SAXDefaultHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class SAXDefaultHandler
extends org.xml.sax.helpers.DefaultHandler

SAX Default Handler. Provided to a SAXParser as DefaultHandler, will monitor parsing exceptions and provide cached dtds (the ones that come with the dostribution, i.e. xhtml, etc.).

Author:
Stephane JAIS

Field Summary
static java.lang.String CACHE_DIR
          The directory used to store cached DTDs
static java.lang.String[] CACHED_RESOURCES
          All the DTDs that should be found in net.sf.cantina.resources
static java.lang.String DTD_XHTML_TRANS
          The SYSTEM of the XHTML transitional dtd
static java.lang.String ENT_XHTML_LAT1
          The SYSTEM of the XHTML latin1 entites
static java.lang.String ENT_XHTML_SPECIAL
          The SYSTEM of the XHTML special entites
static java.lang.String ENT_XHTML_SYMBOL
          The SYSTEM of the XHTML symbol entites
(package private) static org.apache.log4j.Logger logger
           
static java.lang.String TEXT_NAME
          The name of the text DTD
static java.lang.String TEXT_PUBLIC_ID
          The PUBLIC ID of the Cantina Text DTD
static java.lang.String TEXT_SYSTEM
          The SYSTEM of the Cantina Text DTD
 
Constructor Summary
SAXDefaultHandler(java.util.List c)
          Contructs a SAXDefaultHandler that will put any SAXException in the provided List.
SAXDefaultHandler(java.util.List c, java.lang.StringBuffer s)
          Contructs a SAXDefaultHandler that will put any SAXException in the provided List, and append all CDATA to the privded StringBuffer
 
Method Summary
 void characters(char[] ch, int start, int length)
          This method is called by the SAX parser when CDATA is encountered.
 void error(org.xml.sax.SAXParseException e)
          Captures errors
 void fatalError(org.xml.sax.SAXParseException e)
          Captures fatalErrors
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
          Provide an InputSource to cached DTDs
 void warning(org.xml.sax.SAXParseException e)
          Captures warning
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endElement, endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger

DTD_XHTML_TRANS

public static final java.lang.String DTD_XHTML_TRANS
The SYSTEM of the XHTML transitional dtd

See Also:
Constant Field Values

ENT_XHTML_LAT1

public static final java.lang.String ENT_XHTML_LAT1
The SYSTEM of the XHTML latin1 entites

See Also:
Constant Field Values

ENT_XHTML_SPECIAL

public static final java.lang.String ENT_XHTML_SPECIAL
The SYSTEM of the XHTML special entites

See Also:
Constant Field Values

ENT_XHTML_SYMBOL

public static final java.lang.String ENT_XHTML_SYMBOL
The SYSTEM of the XHTML symbol entites

See Also:
Constant Field Values

TEXT_SYSTEM

public static final java.lang.String TEXT_SYSTEM
The SYSTEM of the Cantina Text DTD

See Also:
Constant Field Values

TEXT_PUBLIC_ID

public static final java.lang.String TEXT_PUBLIC_ID
The PUBLIC ID of the Cantina Text DTD

See Also:
Constant Field Values

TEXT_NAME

public static final java.lang.String TEXT_NAME
The name of the text DTD

See Also:
Constant Field Values

CACHE_DIR

public static final java.lang.String CACHE_DIR
The directory used to store cached DTDs

See Also:
Constant Field Values

CACHED_RESOURCES

public static final java.lang.String[] CACHED_RESOURCES
All the DTDs that should be found in net.sf.cantina.resources

Constructor Detail

SAXDefaultHandler

public SAXDefaultHandler(java.util.List c)
Contructs a SAXDefaultHandler that will put any SAXException in the provided List.

Parameters:
c - The List that should hold sax errors.

SAXDefaultHandler

public SAXDefaultHandler(java.util.List c,
                         java.lang.StringBuffer s)
Contructs a SAXDefaultHandler that will put any SAXException in the provided List, and append all CDATA to the privded StringBuffer

Parameters:
c - The List that should hold sax errors.
s - The string buffer that should contain CDATA
Method Detail

characters

public void characters(char[] ch,
                       int start,
                       int length)
This method is called by the SAX parser when CDATA is encountered.


warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXException
Captures warning

Throws:
org.xml.sax.SAXException

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Captures fatalErrors

Throws:
org.xml.sax.SAXException

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Captures errors

Throws:
org.xml.sax.SAXException

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
Provide an InputSource to cached DTDs



Copyright © 2004 Cantina. All Rights Reserved.