com.sun.tools.xjc.reader.dtd
Class TDTDReader

java.lang.Object
  extended by com.sun.xml.dtdparser.DTDHandlerBase
      extended by com.sun.tools.xjc.reader.dtd.TDTDReader
All Implemented Interfaces:
com.sun.xml.dtdparser.DTDEventListener, EventListener

public class TDTDReader
extends com.sun.xml.dtdparser.DTDHandlerBase

Parses DTD grammar along with binding information into BGM.


Field Summary
(package private)  BindInfo bindInfo
          binding information.
(package private)  Model model
           
 
Fields inherited from interface com.sun.xml.dtdparser.DTDEventListener
CHOICE, CONTENT_MODEL_ANY, CONTENT_MODEL_CHILDREN, CONTENT_MODEL_EMPTY, CONTENT_MODEL_MIXED, OCCURENCE_ONCE, OCCURENCE_ONE_OR_MORE, OCCURENCE_ZERO_OR_MORE, OCCURENCE_ZERO_OR_ONE, SEQUENCE, USE_FIXED, USE_IMPLIED, USE_NORMAL, USE_REQUIRED
 
Constructor Summary
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)
           
 
Method Summary
 void attributeDecl(String elementName, String attributeName, String attributeType, String[] enumeration, short attributeUse, String defaultValue)
           
 void childElement(String elementName, short occurence)
           
 void connector(short connectorType)
           
protected  CPropertyInfo createAttribute(String elementName, String attributeName, String attributeType, String[] enums, short attributeUse, String defaultValue)
           
 void endContentModel(String elementName, short contentModelType)
           
 void endDTD()
           
 void endModelGroup(short occurence)
           
protected  void error(Locator loc, String prop, Object... args)
           
 void error(SAXParseException e)
           
 void fatalError(SAXParseException e)
           
(package private)  Element getOrCreateElement(String elementName)
           
(package private)  com.sun.codemodel.JPackage getTargetPackage()
           
static Model parse(InputSource dtd, InputSource bindingInfo, ErrorReceiver errorReceiver, Options opts)
          Parses DTD grammar and a binding information into BGM.
 void setDocumentLocator(Locator loc)
           
 void startContentModel(String elementName, short contentModelType)
           
 void startDTD(com.sun.xml.dtdparser.InputEntity entity)
           
 void startModelGroup()
           
 void warning(SAXParseException e)
           
 
Methods inherited from class com.sun.xml.dtdparser.DTDHandlerBase
characters, comment, endCDATA, externalGeneralEntityDecl, externalParameterEntityDecl, ignorableWhitespace, internalGeneralEntityDecl, internalParameterEntityDecl, mixedElement, notationDecl, processingInstruction, startCDATA, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bindInfo

final BindInfo bindInfo
binding information.

This is always non-null even if no binding information was specified. (In that case, a dummy object will be provided.)


model

final Model model
Constructor Detail

TDTDReader

protected TDTDReader(ErrorReceiver errorReceiver,
                     Options opts,
                     InputSource _bindInfo)
              throws AbortException
Throws:
AbortException
Method Detail

parse

public static Model parse(InputSource dtd,
                          InputSource bindingInfo,
                          ErrorReceiver errorReceiver,
                          Options opts)
Parses DTD grammar and a binding information into BGM.

This method is just a utility method that covers 80% of the use cases.

Parameters:
bindingInfo - binding information file, if any. Can be null.

startDTD

public void startDTD(com.sun.xml.dtdparser.InputEntity entity)
              throws SAXException
Specified by:
startDTD in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
startDTD in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

endDTD

public void endDTD()
            throws SAXException
Specified by:
endDTD in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
endDTD in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

getTargetPackage

com.sun.codemodel.JPackage getTargetPackage()

attributeDecl

public void attributeDecl(String elementName,
                          String attributeName,
                          String attributeType,
                          String[] enumeration,
                          short attributeUse,
                          String defaultValue)
                   throws SAXException
Specified by:
attributeDecl in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
attributeDecl in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

createAttribute

protected CPropertyInfo createAttribute(String elementName,
                                        String attributeName,
                                        String attributeType,
                                        String[] enums,
                                        short attributeUse,
                                        String defaultValue)
                                 throws SAXException
Throws:
SAXException

getOrCreateElement

Element getOrCreateElement(String elementName)

startContentModel

public void startContentModel(String elementName,
                              short contentModelType)
                       throws SAXException
Specified by:
startContentModel in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
startContentModel in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

endContentModel

public void endContentModel(String elementName,
                            short contentModelType)
                     throws SAXException
Specified by:
endContentModel in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
endContentModel in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

startModelGroup

public void startModelGroup()
                     throws SAXException
Specified by:
startModelGroup in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
startModelGroup in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

endModelGroup

public void endModelGroup(short occurence)
                   throws SAXException
Specified by:
endModelGroup in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
endModelGroup in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

connector

public void connector(short connectorType)
               throws SAXException
Specified by:
connector in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
connector in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

childElement

public void childElement(String elementName,
                         short occurence)
                  throws SAXException
Specified by:
childElement in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
childElement in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

setDocumentLocator

public void setDocumentLocator(Locator loc)
Specified by:
setDocumentLocator in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
setDocumentLocator in class com.sun.xml.dtdparser.DTDHandlerBase

error

public void error(SAXParseException e)
           throws SAXException
Specified by:
error in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
error in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

fatalError

public void fatalError(SAXParseException e)
                throws SAXException
Specified by:
fatalError in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
fatalError in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

warning

public void warning(SAXParseException e)
             throws SAXException
Specified by:
warning in interface com.sun.xml.dtdparser.DTDEventListener
Overrides:
warning in class com.sun.xml.dtdparser.DTDHandlerBase
Throws:
SAXException

error

protected final void error(Locator loc,
                           String prop,
                           Object... args)