org.dbunit.dataset.xml
Class XmlProducer

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

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

Parses an XML and produces a dataset from it.

Since:
Apr 30, 2003
Version:
$Revision: 815 $ $Date: 2008-09-27 14:33:56 +0200 (Sat, 27 Sep 2008) $
Author:
Manuel Laflamme, Last changed by: $Author: gommma $

Constructor Summary
XmlProducer(InputSource inputSource)
           
 
Method Summary
protected static DataSetException buildException(SAXException cause)
          Wraps a SAXException into a DataSetException
 void characters(char[] ch, int start, int length)
           
 void endElement(String uri, String localName, String qName)
           
 void error(SAXParseException e)
           
 void produce()
          Process this dataset source.
 InputSource resolveEntity(String publicId, String systemId)
           
 void setConsumer(IDataSetConsumer consumer)
           
 void setValidating(boolean validating)
           
 void startElement(String uri, String localName, String qName, Attributes attributes)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
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
endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ErrorHandler
fatalError, warning
 

Constructor Detail

XmlProducer

public XmlProducer(InputSource inputSource)
Method Detail

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

buildException

protected static final DataSetException buildException(SAXException cause)
Wraps a SAXException into a DataSetException

Parameters:
cause - The cause to be wrapped into a DataSetException
Returns:
A DataSetException that wraps the given SAXException

resolveEntity

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

startElement

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

endElement

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

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
Throws:
SAXException

error

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


Copyright © 2002-2012. All Rights Reserved.