O2Plib.db
Class DbSample.SsfContentHandler

java.lang.Object
  extended by O2Plib.db.DbSample.SsfContentHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler
Enclosing class:
DbSample

 class DbSample.SsfContentHandler
extends java.lang.Object
implements org.xml.sax.ContentHandler

This class implements the SAX ContentHandler interface and defines callback behavior for the SAX callbacks associated with an XML document's content, stuffing data structures with correct data from xml files.


Field Summary
private  java.io.CharArrayWriter contents
           
 DbSample dbSample
          where most of the data is
private  boolean DEBUG_CH
          local debug flag
private  org.xml.sax.Locator locator
          Hold onto the locator for location information for debugging
private  java.util.Map namespaceMappings
          Store URI to prefix mappings
private  DbSpot p
          instance of current DbSpot
private  java.lang.String previousTag
          previous tag found
private  boolean spotFeatureFailureFlag
           
private  boolean spotFlag
          when the begining of the list of spots is found
 
Constructor Summary
DbSample.SsfContentHandler()
          SsfContentHandler() - constructor()
 
Method Summary
 void characters(char[] ch, int start, int length)
          characters() - This reports character data (within an element).
 void endDocument()
          endDocument() - This indicates the end of a Document parse-this occurs after all callbacks in all SAX Handlers..
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          endElement() - Indicates the end of an element (</[element name]>) is reached.
 void endPrefixMapping(java.lang.String prefix)
          endPrefixMapping() - This indicates the end of a prefix mapping, when the namespace reported in a startPrefixMapping(java.lang.String, java.lang.String) callback is no longer available.
 java.lang.String getLocatorPrevTag()
          getLocatorPrevTag() - get locator and previous tag for debugging.
 boolean goParse(java.lang.String fileName, DbSample dbSample)
          goParse() - parse XML file for prologue, spot, and epilogue data.
 void ignorableWhitespace(char[] c, int start, int len)
          ignorableWhitespace() -
 void processingInstruction(java.lang.String target, java.lang.String data)
          processingInstruction() - This indicates that a processing instruction (other than the XML declaration) has been encountered.
 void setDocumentLocator(org.xml.sax.Locator locator)
          setDocumentLocator() -Provide reference to Locator which provides information about where in a document callbacks occur.
 void skippedEntity(java.lang.String name)
          skippedEntity() - This reports an entity that is skipped by the parser.
 void startDocument()
          startDocument() - This indicates the start of a Document parse-this precedes all callbacks in all SAX Handlers with the sole exception of setDocumentLocator(org.xml.sax.Locator).
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          startElement() - This reports the occurrence of an actual element.
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          startPrefixMapping() - This indicates the beginning of an XML Namespace prefix mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbSample

public DbSample dbSample
where most of the data is


DEBUG_CH

private final boolean DEBUG_CH
local debug flag

See Also:
Constant Field Values

locator

private org.xml.sax.Locator locator
Hold onto the locator for location information for debugging


namespaceMappings

private java.util.Map namespaceMappings
Store URI to prefix mappings


contents

private java.io.CharArrayWriter contents

spotFlag

private boolean spotFlag
when the begining of the list of spots is found


spotFeatureFailureFlag

private boolean spotFeatureFailureFlag

p

private DbSpot p
instance of current DbSpot


previousTag

private java.lang.String previousTag
previous tag found

Constructor Detail

DbSample.SsfContentHandler

public DbSample.SsfContentHandler()
SsfContentHandler() - constructor()

Method Detail

goParse

public boolean goParse(java.lang.String fileName,
                       DbSample dbSample)
                throws java.lang.Exception
goParse() - parse XML file for prologue, spot, and epilogue data.

Parameters:
fileName - to read
dbSample - structure to save the data
Returns:
true if successfull.
Throws:
java.lang.Exception

getLocatorPrevTag

public java.lang.String getLocatorPrevTag()
getLocatorPrevTag() - get locator and previous tag for debugging.

Returns:
string of (locator,previousTag)

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
setDocumentLocator() -Provide reference to Locator which provides information about where in a document callbacks occur.

Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Parameters:
locator - Locator object tied to callback process

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
startDocument() - This indicates the start of a Document parse-this precedes all callbacks in all SAX Handlers with the sole exception of setDocumentLocator(org.xml.sax.Locator).

Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
SAXException - when things go wrong
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
endDocument() - This indicates the end of a Document parse-this occurs after all callbacks in all SAX Handlers..

Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
SAXException - when things go wrong
org.xml.sax.SAXException

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
processingInstruction() - This indicates that a processing instruction (other than the XML declaration) has been encountered.

Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Parameters:
target - String target of PI
data - StringThrows:
SAXException - when things go wrong
org.xml.sax.SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
startPrefixMapping() - This indicates the beginning of an XML Namespace prefix mapping. Although this typically occurs within the root element of an XML document, it can occur at any point within the document. Note that a prefix mapping on an element triggers this callback before the callback for the actual element itself (startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)) occurs.

Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
prefix - String prefix used for the namespace being reported
uri - String URI for the namespace being reported
Throws:
SAXException - when things go wrong

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
endPrefixMapping() - This indicates the end of a prefix mapping, when the namespace reported in a startPrefixMapping(java.lang.String, java.lang.String) callback is no longer available.

Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Parameters:
prefix - String of namespace being reported
Throws:
SAXException - when things go wrong

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
startElement() - This reports the occurrence of an actual element. It includes the element's attributes, with the exception of XML vocabulary specific attributes, such as xmlns:[namespace prefix] and xsi:schemaLocation.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Parameters:
namespaceURI - String namespace URI this element is associated with, or an empty String
localName - String name of element (with no namespace prefix, if one is present)
qName - String XML 1.0 version of element name: [namespace prefix]:[localName]
atts - Attributes list for this element
Throws:
SAXException - when things go wrong
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
endElement() - Indicates the end of an element (</[element name]>) is reached. Note that the parser does not distinguish between empty elements and non-empty elements, so this occurs uniformly.

It builds the DbSpot instance and saves it in the current spot list listG which it updates if it passes the -ssfCW filter (if enabled). It also builds the DbSample preface and epilogue structures/

Specified by:
endElement in interface org.xml.sax.ContentHandler
Parameters:
namespaceURI - String URI of namespace this element is associated with
localName - String name of element without prefix
qName - String name of element in XML 1.0 form
Throws:
SAXException - when things go wrong
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
characters() - This reports character data (within an element).

Specified by:
characters in interface org.xml.sax.ContentHandler
Parameters:
ch - char[] character array with character data
start - int index in array where data starts.
length - int index in array where data ends.
Throws:
SAXException - when things go wrong
org.xml.sax.SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] c,
                                int start,
                                int len)
ignorableWhitespace() -

Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws org.xml.sax.SAXException
skippedEntity() - This reports an entity that is skipped by the parser. This should only occur for non-validating parsers, and then is still implementation-dependent behavior.

Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Parameters:
name - String name of entity being skipped
Throws:
SAXException - when things go wrong
org.xml.sax.SAXException