org.dbunit.dataset.xml
Class FlatDtdProducer

java.lang.Object
  extended by org.dbunit.dataset.xml.FlatDtdProducer
All Implemented Interfaces:
IDataSetProducer, EntityResolver, DeclHandler, LexicalHandler

public class FlatDtdProducer
extends Object
implements IDataSetProducer, EntityResolver, DeclHandler, LexicalHandler

Produces a DataSet from a flat DTD. Only external DTDs are supported and for the root element only the following declarations are supported.

Combinations of sequences and choices are not support nor are #PCDATA or EMPTY declarations.

Since:
Apr 27, 2003
Version:
$Revision: 863 $ $Date: 2008-11-07 10:35:46 +0100 (Fri, 07 Nov 2008) $
Author:
Manuel Laflamme, Last changed by: $Author: gommma $

Field Summary
static String ANY
          Constant for the value "ANY"
static String IMPLIED
          Constant for the value "#IMPLIED"
static String REQUIRED
          Constant for the value "#REQUIRED"
 
Constructor Summary
FlatDtdProducer()
           
FlatDtdProducer(InputSource inputSource)
           
 
Method Summary
 void attributeDecl(String elementName, String attributeName, String type, String mode, String value)
           
protected  String cleanupTableName(String tableName)
           
 void comment(char[] ch, int start, int length)
           
 void elementDecl(String name, String model)
           
 void endCDATA()
           
 void endDTD()
           
 void endEntity(String name)
           
 void externalEntityDecl(String name, String publicId, String systemId)
           
 void internalEntityDecl(String name, String value)
           
 void produce()
          Process this dataset source.
 InputSource resolveEntity(String publicId, String systemId)
           
 void setConsumer(IDataSetConsumer consumer)
           
static void setDeclHandler(XMLReader xmlReader, DeclHandler handler)
           
static void setLexicalHandler(XMLReader xmlReader, LexicalHandler handler)
           
 void startCDATA()
           
 void startDTD(String name, String publicId, String systemId)
           
 void startEntity(String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUIRED

public static final String REQUIRED
Constant for the value "#REQUIRED"

See Also:
Constant Field Values

IMPLIED

public static final String IMPLIED
Constant for the value "#IMPLIED"

See Also:
Constant Field Values

ANY

public static final String ANY
Constant for the value "ANY"

See Also:
Constant Field Values
Constructor Detail

FlatDtdProducer

public FlatDtdProducer()

FlatDtdProducer

public FlatDtdProducer(InputSource inputSource)
Method Detail

setDeclHandler

public static void setDeclHandler(XMLReader xmlReader,
                                  DeclHandler handler)
                           throws SAXNotRecognizedException,
                                  SAXNotSupportedException
Throws:
SAXNotRecognizedException
SAXNotSupportedException

setLexicalHandler

public static void setLexicalHandler(XMLReader xmlReader,
                                     LexicalHandler handler)
                              throws SAXNotRecognizedException,
                                     SAXNotSupportedException
Throws:
SAXNotRecognizedException
SAXNotSupportedException

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 InputSource resolveEntity(String publicId,
                                 String systemId)
                          throws SAXException
Specified by:
resolveEntity in interface EntityResolver
Throws:
SAXException

elementDecl

public void elementDecl(String name,
                        String model)
                 throws SAXException
Specified by:
elementDecl in interface DeclHandler
Throws:
SAXException

attributeDecl

public void attributeDecl(String elementName,
                          String attributeName,
                          String type,
                          String mode,
                          String value)
                   throws SAXException
Specified by:
attributeDecl in interface DeclHandler
Throws:
SAXException

internalEntityDecl

public void internalEntityDecl(String name,
                               String value)
                        throws SAXException
Specified by:
internalEntityDecl in interface DeclHandler
Throws:
SAXException

externalEntityDecl

public void externalEntityDecl(String name,
                               String publicId,
                               String systemId)
                        throws SAXException
Specified by:
externalEntityDecl in interface DeclHandler
Throws:
SAXException

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
Specified by:
startDTD in interface LexicalHandler
Throws:
SAXException

endDTD

public void endDTD()
            throws SAXException
Specified by:
endDTD in interface LexicalHandler
Throws:
SAXException

cleanupTableName

protected String cleanupTableName(String tableName)

startEntity

public void startEntity(String name)
                 throws SAXException
Specified by:
startEntity in interface LexicalHandler
Throws:
SAXException

endEntity

public void endEntity(String name)
               throws SAXException
Specified by:
endEntity in interface LexicalHandler
Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
Specified by:
startCDATA in interface LexicalHandler
Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Specified by:
endCDATA in interface LexicalHandler
Throws:
SAXException

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
Specified by:
comment in interface LexicalHandler
Throws:
SAXException


Copyright © 2002-2012. All Rights Reserved.