org.dbunit.dataset.xml
Class FlatXmlProducer

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.dbunit.dataset.xml.FlatXmlProducer
All Implemented Interfaces:
IDataSetProducer, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class FlatXmlProducer
extends org.xml.sax.helpers.DefaultHandler
implements IDataSetProducer, org.xml.sax.ContentHandler

Since:
1.5 (Apr 18, 2003)
Version:
$Revision: 1048 $ $Date: 2009-09-26 18:21:40 +0200 (sab, 26 set 2009) $
Author:
Manuel Laflamme, Last changed by: $Author: gommma $

Constructor Summary
FlatXmlProducer(org.xml.sax.InputSource xmlSource)
           
FlatXmlProducer(org.xml.sax.InputSource xmlSource, boolean dtdMetadata)
           
FlatXmlProducer(org.xml.sax.InputSource xmlSource, boolean dtdMetadata, boolean columnSensing)
           
FlatXmlProducer(org.xml.sax.InputSource xmlSource, boolean dtdMetadata, boolean columnSensing, boolean caseSensitiveTableNames)
           
FlatXmlProducer(org.xml.sax.InputSource xmlSource, org.xml.sax.EntityResolver resolver)
           
FlatXmlProducer(org.xml.sax.InputSource xmlSource, IDataSet metaDataSet)
           
 
Method Summary
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
           
 void error(org.xml.sax.SAXParseException e)
           
protected  void handleMissingColumns(org.xml.sax.Attributes attributes)
          parses the attributes in the current row, and checks whether a new column is found.
 boolean isCaseSensitiveTableNames()
           
 void produce()
          Process this dataset source.
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
           
 void setColumnSensing(boolean columnSensing)
           
 void setConsumer(IDataSetConsumer consumer)
           
 void setValidating(boolean validating)
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
characters, endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
 

Constructor Detail

FlatXmlProducer

public FlatXmlProducer(org.xml.sax.InputSource xmlSource)

FlatXmlProducer

public FlatXmlProducer(org.xml.sax.InputSource xmlSource,
                       boolean dtdMetadata)

FlatXmlProducer

public FlatXmlProducer(org.xml.sax.InputSource xmlSource,
                       IDataSet metaDataSet)

FlatXmlProducer

public FlatXmlProducer(org.xml.sax.InputSource xmlSource,
                       org.xml.sax.EntityResolver resolver)

FlatXmlProducer

public FlatXmlProducer(org.xml.sax.InputSource xmlSource,
                       boolean dtdMetadata,
                       boolean columnSensing)
Parameters:
xmlSource - The input datasource
dtdMetadata - Whether or not DTD metadata is available to parse via a DTD handler
columnSensing - Whether or not the column sensing feature should be used (see FAQ)

FlatXmlProducer

public FlatXmlProducer(org.xml.sax.InputSource xmlSource,
                       boolean dtdMetadata,
                       boolean columnSensing,
                       boolean caseSensitiveTableNames)
Parameters:
xmlSource - The input datasource
dtdMetadata - Whether or not DTD metadata is available to parse via a DTD handler
columnSensing - Whether or not the column sensing feature should be used (see FAQ)
caseSensitiveTableNames - Whether or not this dataset should use case sensitive table names
Since:
2.4.2
Method Detail

isCaseSensitiveTableNames

public boolean isCaseSensitiveTableNames()
Returns:
Whether or not this producer works case sensitively
Since:
2.4.7

handleMissingColumns

protected void handleMissingColumns(org.xml.sax.Attributes attributes)
                             throws DataSetException
parses the attributes in the current row, and checks whether a new column is found.

Depending on the value of the columnSensing flag, the appropriate action is taken:

Parameters:
attributes - Attributed for the current row.
Throws:
DataSetException

setColumnSensing

public void setColumnSensing(boolean columnSensing)

setValidating

public void setValidating(boolean validating)

setConsumer

public void setConsumer(IDataSetConsumer consumer)
                 throws DataSetException
Specified by:
setConsumer in interface IDataSetProducer
Throws:
DataSetException

produce

public void produce()
             throws DataSetException
Description copied from interface: IDataSetProducer
Process this dataset source. During the processing, the IDataSetProducer will provide information about the dataset through the specified event listener.

This method is synchronous: it will not return until processing has ended. If a client application wants to terminate parsing early, it should throw an exception from the listener.

Specified by:
produce in interface IDataSetProducer
Throws:
DataSetException

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException
Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Overrides:
resolveEntity in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Specified by:
error in interface org.xml.sax.ErrorHandler
Overrides:
error in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       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
Throws:
org.xml.sax.SAXException


Copyright © 2002-2010. All Rights Reserved.