com.softwareag.tamino.db.api.objectModel.sax
Class TSAXDocumentDefaultHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.softwareag.tamino.db.api.objectModel.sax.TSAXDocumentDefaultHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public abstract class TSAXDocumentDefaultHandler
extends org.xml.sax.helpers.DefaultHandler

TSAXDocumentDefaultHandler is a SAX DefaultHandler class. You must provide a class extending this class when using a SAX object model and intend to use the SAX object model to process single XML documents. Single XML documents are either returned by Tamino via a retrieve method of an accessor or are instantiated using one of the newInstance factory methods of the TXMLObject class.

The TSAXDocumentDefaultHandler instance specified for a SAX object model receives events for an XML document obtained from Tamino via the retrieve method or if a TXMLObject instance is created. The document handler should create an instance of the class implementing the TSAXDocument interface associated with the same SAX object model. The following code example shows the usage of a SAX object model and a document handler.

            // instantiate a SAX object model with a document handler
            TSAXObjectModel mySAXObjectModel = new TSAXObjectModel( "MySAXModel" ,
         MySAXDocument.class ,
         null ,
                mySAXDocumentDefaultHandler ,
                null );
     // instantiate a TXMLObject for this model
            TXMLObject xmlObject = TXMLObject.newInstance( mySAXObjectModel );
     // fill the instance with data.
            // reading from an input stream will send SAX events to the document handler.
            xmlObject.readFrom( someInputStream );
     // writing to an output stream requires an appropriate implementation of the
     // writeTo method of the associate TSAXDocument class.
     MySaxDocument mySaxDocument = xmlObject.getDocument();
            mySaxDocument.writeTo( someOutputStream );
        

Version:
$Revision: 1.4 $
Author:
Marcus Schreyer

Field Summary
static java.lang.String SPECIFIER
          An internal identification for this interface.
 
Constructor Summary
TSAXDocumentDefaultHandler()
           
 
Method Summary
abstract  TSAXDocument getDocument()
          Returns a TSAXDocument representing the single underlying XML document.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPECIFIER

public static final java.lang.String SPECIFIER
An internal identification for this interface.

Constructor Detail

TSAXDocumentDefaultHandler

public TSAXDocumentDefaultHandler()
Method Detail

getDocument

public abstract TSAXDocument getDocument()
Returns a TSAXDocument representing the single underlying XML document. Each class extending TSAXDocumentDefaultHandler may choose to implement this method or not. An implementation is required if the getDocument method of TXMLObject instances created for the SAYX object model in question is to return meaningful information. The instance returned by this method is the instance returned by the getDocument method of TXMLObject.

Returns:
a TSAXDocument instance or null.


Copyright (c) 2013 Software AG. All Rights Reserved.