org.oreodata.metadata
Class XMLRecordHandler

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--org.oreodata.xml.HierarchicalHandler
              |
              +--org.oreodata.metadata.XMLRecordHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class XMLRecordHandler
extends HierarchicalHandler

A SAX Event handler that takes over when a parent handler realizes that we have a record element. This handler then fills in a record's fields on the basis of the SAX events it receives. This handler only handles a single record.


Field Summary
 
Fields inherited from class org.oreodata.xml.HierarchicalHandler
parentHandler, parser
 
Constructor Summary
protected XMLRecordHandler(HierarchicalHandler parent, Record record, boolean recurse)
          Use this constructor if you are handing off control to the handler and already know the record type.
protected XMLRecordHandler(org.xml.sax.XMLReader parser, Record record, boolean recurse)
          Use this constructor if this is the root handler and the Record is being fed in as a standalone XML document.
 
Method Summary
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 java.util.List getNestedHandlers()
           
 Record getRecord()
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 
Methods inherited from class org.oreodata.xml.HierarchicalHandler
getDocumentLocator, parseTimeStampString, rethrowAsSAX, setDocumentLocator
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLRecordHandler

protected XMLRecordHandler(org.xml.sax.XMLReader parser,
                           Record record,
                           boolean recurse)
Use this constructor if this is the root handler and the Record is being fed in as a standalone XML document.

Parameters:
parser - The source of the SAX events.
recurse - Do we recurse into nested records?

XMLRecordHandler

protected XMLRecordHandler(HierarchicalHandler parent,
                           Record record,
                           boolean recurse)
Use this constructor if you are handing off control to the handler and already know the record type. i.e. you've already parsed the <rec_type blah blah> bit.

Parameters:
parent - The parent handler to return control to.
recurse - Do we recurse into nested records?
Method Detail

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
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
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
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException

getRecord

public Record getRecord()

getNestedHandlers

public java.util.List getNestedHandlers()