Package com.sun.tools.xjc.reader.dtd
Class TDTDReader
java.lang.Object
com.sun.xml.dtdparser.DTDHandlerBase
com.sun.tools.xjc.reader.dtd.TDTDReader
- All Implemented Interfaces:
DTDEventListener,EventListener
Parses DTD grammar along with binding information into BGM.
- Author:
- Kohsuke KAWAGUCHI
-
Field Summary
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
ConstructorsModifierConstructorDescriptionprotectedTDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo) -
Method Summary
Modifier and TypeMethodDescriptionvoidattributeDecl(String elementName, String attributeName, String attributeType, String[] enumeration, short attributeUse, String defaultValue) For each entry in an ATTLIST declaration, this event will be fired.voidchildElement(String elementName, short occurence) voidconnector(short connectorType) Connectors in one model group is guaranteed to be the same.protected CPropertyInfocreateAttribute(String elementName, String attributeName, String attributeType, String[] enums, short attributeUse, String defaultValue) voidendContentModel(String elementName, short contentModelType) receives notification that parsing of content model is finished.voidendDTD()Receive notification of the end of a DTD.voidendModelGroup(short occurence) protected final voidvoidvoidstatic Modelparse(InputSource dtd, InputSource bindingInfo, ErrorReceiver errorReceiver, Options opts) Parses DTD grammar and a binding information into BGM.voidvoidstartContentModel(String elementName, short contentModelType) receives notification that parsing of content model is beginning.voidstartDTD(InputEntity entity) Receive notification of the beginning of the DTD.voidvoidMethods inherited from class com.sun.xml.dtdparser.DTDHandlerBase
characters, comment, endCDATA, externalGeneralEntityDecl, externalParameterEntityDecl, ignorableWhitespace, internalGeneralEntityDecl, internalParameterEntityDecl, mixedElement, notationDecl, processingInstruction, startCDATA, unparsedEntityDecl
-
Constructor Details
-
TDTDReader
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo) throws AbortException - Throws:
AbortException
-
-
Method Details
-
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
Description copied from interface:DTDEventListenerReceive notification of the beginning of the DTD.- Specified by:
startDTDin interfaceDTDEventListener- Overrides:
startDTDin classDTDHandlerBase- Parameters:
entity- Current input entity.- Throws:
SAXException- for errors- See Also:
-
endDTD
Description copied from interface:DTDEventListenerReceive notification of the end of a DTD. The parser will invoke this method only once.- Specified by:
endDTDin interfaceDTDEventListener- Overrides:
endDTDin classDTDHandlerBase- Throws:
SAXException- for errors- See Also:
-
attributeDecl
public void attributeDecl(String elementName, String attributeName, String attributeType, String[] enumeration, short attributeUse, String defaultValue) throws SAXException Description copied from interface:DTDEventListenerFor each entry in an ATTLIST declaration, this event will be fired.DTD allows the same attributes to be declared more than once, and in that case the first one wins. I think this method will be only fired for the first one, but I need to check.
- Specified by:
attributeDeclin interfaceDTDEventListener- Overrides:
attributeDeclin classDTDHandlerBase- Throws:
SAXException- for errors
-
createAttribute
protected CPropertyInfo createAttribute(String elementName, String attributeName, String attributeType, String[] enums, short attributeUse, String defaultValue) throws SAXException - Throws:
SAXException
-
startContentModel
Description copied from interface:DTDEventListenerreceives notification that parsing of content model is beginning.- Specified by:
startContentModelin interfaceDTDEventListener- Overrides:
startContentModelin classDTDHandlerBase- Parameters:
elementName- name of the element whose content model is going to be defined.contentModelType-DTDEventListener.CONTENT_MODEL_EMPTYthis element has EMPTY content model. This notification will be immediately followed by the corresponding endContentModel.DTDEventListener.CONTENT_MODEL_ANYthis element has ANY content model. This notification will be immediately followed by the corresponding endContentModel.DTDEventListener.CONTENT_MODEL_MIXEDthis element has mixed content model. #PCDATA will not be reported. each child element will be reported by mixedElement method.DTDEventListener.CONTENT_MODEL_CHILDRENthis elemen has child content model. The actual content model will be reported by childElement, startModelGroup, endModelGroup, and connector methods. Possible call sequences are:START := MODEL_GROUP MODEL_GROUP := startModelGroup TOKEN (connector TOKEN)* endModelGroup TOKEN := childElement | MODEL_GROUP
- Throws:
SAXException- for errors
-
endContentModel
Description copied from interface:DTDEventListenerreceives notification that parsing of content model is finished.- Specified by:
endContentModelin interfaceDTDEventListener- Overrides:
endContentModelin classDTDHandlerBase- Throws:
SAXException- for errors
-
startModelGroup
- Specified by:
startModelGroupin interfaceDTDEventListener- Overrides:
startModelGroupin classDTDHandlerBase- Throws:
SAXException
-
endModelGroup
- Specified by:
endModelGroupin interfaceDTDEventListener- Overrides:
endModelGroupin classDTDHandlerBase- Throws:
SAXException
-
connector
Description copied from interface:DTDEventListenerConnectors in one model group is guaranteed to be the same.IOW, you'll never see an event sequence like (a|b,c)
- Specified by:
connectorin interfaceDTDEventListener- Overrides:
connectorin classDTDHandlerBase- Throws:
SAXException- for errors
-
childElement
- Specified by:
childElementin interfaceDTDEventListener- Overrides:
childElementin classDTDHandlerBase- Throws:
SAXException
-
setDocumentLocator
- Specified by:
setDocumentLocatorin interfaceDTDEventListener- Overrides:
setDocumentLocatorin classDTDHandlerBase
-
error
- Specified by:
errorin interfaceDTDEventListener- Overrides:
errorin classDTDHandlerBase- Throws:
SAXException
-
fatalError
- Specified by:
fatalErrorin interfaceDTDEventListener- Overrides:
fatalErrorin classDTDHandlerBase- Throws:
SAXException
-
warning
- Specified by:
warningin interfaceDTDEventListener- Overrides:
warningin classDTDHandlerBase- Throws:
SAXException
-
error
-