Top Description Inners Fields Constructors Methods
com.sun.tools.xjc.reader.dtd

public Class TDTDReader

extends DTDHandlerBase
Class Inheritance
Imports
java.io.IOException, java.util.Collections, .HashMap, .Map, .Stack, javax.xml.namespace.QName, com.sun.codemodel.JClass, .JCodeModel, .JDefinedClass, .JPackage, com.sun.tools.xjc.AbortException, .ErrorReceiver, .Options, .Plugin, com.sun.tools.xjc.model.CAttributePropertyInfo, .CBuiltinLeafInfo, .CClassInfo, .CPropertyInfo, .Model, .TypeUse, .TypeUseFactory, .CDefaultValue, com.sun.tools.xjc.reader.ModelChecker, .Ring, com.sun.tools.xjc.reader.dtd.bindinfo.BIAttribute, .BIElement, .BIInterface, .BindInfo, com.sun.tools.xjc.util.CodeModelClassFactory, .ErrorReceiverFilter, org.glassfish.jaxb.core.api.impl.NameConverter, com.sun.xml.dtdparser.DTDHandlerBase, .DTDParser, .InputEntity, com.sun.xml.xsom.XmlString, com.sun.istack.SAXParseException2, org.xml.sax.EntityResolver, .InputSource, .Locator, .SAXException, .SAXParseException, org.xml.sax.helpers.LocatorImpl

Parses DTD grammar along with binding information into BGM.
Author
Kohsuke KAWAGUCHI

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface

Field Summary

Modifier and TypeField and Description
pack-priv final BindInfo
bindInfo

binding information.

private static final Map<String, TypeUse>
builtinConversions

Transducers for the built-in types.

private final CodeModelClassFactory
private final Map<String, Element>
elements

Element name to its content model definition.

private final EntityResolver
private final ErrorReceiverFilter
private Locator
locator

Mutable Locator instance that points to the current source line.

pack-priv final Model
private final Stack<ModelGroup>

Constructor Summary

AccessConstructor and Description
protected
TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo)

Method Summary

Modifier and TypeMethod and Description
public void
attributeDecl(String elementName, String attributeName, String attributeType, String[] enumeration, short attributeUse, String defaultValue)

Overrides com.sun.xml.dtdparser.DTDHandlerBase.attributeDecl.

Implements com.sun.xml.dtdparser.DTDEventListener.attributeDecl.

For each entry in an ATTLIST declaration, this event will be fired.

public void
public void
connector(short connectorType)

Overrides com.sun.xml.dtdparser.DTDHandlerBase.connector.

Implements com.sun.xml.dtdparser.DTDEventListener.connector.

Connectors in one model group is guaranteed to be the same.

private Locator
copyLocator()

Creates a snapshot of the current locator values.

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

public void
endContentModel(String elementName, short contentModelType)

Overrides com.sun.xml.dtdparser.DTDHandlerBase.endContentModel.

Implements com.sun.xml.dtdparser.DTDEventListener.endContentModel.

receives notification that parsing of content model is finished.

public void
endDTD()

Overrides com.sun.xml.dtdparser.DTDHandlerBase.endDTD.

Implements com.sun.xml.dtdparser.DTDEventListener.endDTD.

Receive notification of the end of a DTD.

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

public void
pack-priv Element
pack-priv JPackage
public static Model
parse(InputSource dtd, InputSource
binding information file, if any. Can be null.
bindingInfo
,
ErrorReceiver errorReceiver, Options opts)

Parses DTD grammar and a binding information into BGM.

private void
processConstructorDeclarations()

Creates constructor declarations as specified in the binding information.

private void
processInterfaceDeclarations()

Processes interface declarations.

public void
public void
startContentModel(String elementName, short contentModelType)

Overrides com.sun.xml.dtdparser.DTDHandlerBase.startContentModel.

Implements com.sun.xml.dtdparser.DTDEventListener.startContentModel.

receives notification that parsing of content model is beginning.

public void
startDTD(InputEntity entity)

Overrides com.sun.xml.dtdparser.DTDHandlerBase.startDTD.

Implements com.sun.xml.dtdparser.DTDEventListener.startDTD.

Receive notification of the beginning of the DTD.

public void
public void
Inherited from com.sun.xml.dtdparser.DTDHandlerBase:
characterscommentendCDATAexternalGeneralEntityDeclexternalParameterEntityDeclignorableWhitespaceinternalGeneralEntityDeclinternalParameterEntityDeclmixedElementnotationDeclprocessingInstructionstartCDATAunparsedEntityDecl

Field Detail

bindInfoback to summary
pack-priv 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.)

builtinConversionsback to summary
private static final Map<String, TypeUse> builtinConversions

Transducers for the built-in types. Read-only.

classFactoryback to summary
private final CodeModelClassFactory classFactory
elementsback to summary
private final Map<String, Element> elements

Element name to its content model definition.

entityResolverback to summary
private final EntityResolver entityResolver
errorReceiverback to summary
private final ErrorReceiverFilter errorReceiver
locatorback to summary
private Locator locator

Mutable Locator instance that points to the current source line.

Use copyLocator() to get an immutable clone.

modelback to summary
pack-priv final Model model
modelGroupsback to summary
private final Stack<ModelGroup> modelGroups

Constructor Detail

TDTDReaderback to summary
protected TDTDReader(ErrorReceiver errorReceiver, Options opts, InputSource _bindInfo) throws AbortException

Method Detail

attributeDeclback to summary
public void attributeDecl(String elementName, String attributeName, String attributeType, String[] enumeration, short attributeUse, String defaultValue) throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.attributeDecl.

Implements com.sun.xml.dtdparser.DTDEventListener.attributeDecl.

Doc from com.sun.xml.dtdparser.DTDEventListener.attributeDecl.

For 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.

Annotations
@Override
Exceptions
SAXException:
for errors
childElementback to summary
public void childElement(String elementName, short occurrence) throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.childElement.

Implements com.sun.xml.dtdparser.DTDEventListener.childElement.

Annotations
@Override
connectorback to summary
public void connector(short connectorType) throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.connector.

Implements com.sun.xml.dtdparser.DTDEventListener.connector.

Doc from com.sun.xml.dtdparser.DTDEventListener.connector.

Connectors in one model group is guaranteed to be the same.

IOW, you'll never see an event sequence like (a|b,c)

Annotations
@Override
Exceptions
SAXException:
for errors
copyLocatorback to summary
private Locator copyLocator()

Creates a snapshot of the current locator values.

createAttributeback to summary
protected CPropertyInfo createAttribute(String elementName, String attributeName, String attributeType, String[] enums, short attributeUse, String defaultValue) throws SAXException
endContentModelback to summary
public void endContentModel(String elementName, short contentModelType) throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.endContentModel.

Implements com.sun.xml.dtdparser.DTDEventListener.endContentModel.

Doc from com.sun.xml.dtdparser.DTDEventListener.endContentModel.

receives notification that parsing of content model is finished.

Annotations
@Override
Exceptions
SAXException:
for errors
endDTDback to summary
public void endDTD() throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.endDTD.

Implements com.sun.xml.dtdparser.DTDEventListener.endDTD.

Doc from com.sun.xml.dtdparser.DTDEventListener.endDTD.

Receive notification of the end of a DTD. The parser will invoke this method only once.

Annotations
@Override
Exceptions
SAXException:
for errors
endModelGroupback to summary
public void endModelGroup(short occurrence) throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.endModelGroup.

Implements com.sun.xml.dtdparser.DTDEventListener.endModelGroup.

Annotations
@Override
errorback to summary
public void error(SAXParseException e) throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.error.

Implements com.sun.xml.dtdparser.DTDEventListener.error.

Annotations
@Override
errorback to summary
protected final void error(Locator loc, String prop, Object... args)
fatalErrorback to summary
public void fatalError(SAXParseException e) throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.fatalError.

Implements com.sun.xml.dtdparser.DTDEventListener.fatalError.

Annotations
@Override
getOrCreateElementback to summary
pack-priv Element getOrCreateElement(String elementName)
getTargetPackageback to summary
pack-priv JPackage getTargetPackage()
parseback to summary
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:InputSource

binding information file, if any. Can be null.

processConstructorDeclarationsback to summary
private void processConstructorDeclarations()

Creates constructor declarations as specified in the binding information.

Also checks that the binding file does not contain declarations for non-existent elements.

processInterfaceDeclarationsback to summary
private void processInterfaceDeclarations()

Processes interface declarations.

setDocumentLocatorback to summary
public void setDocumentLocator(Locator loc)

Overrides com.sun.xml.dtdparser.DTDHandlerBase.setDocumentLocator.

Implements com.sun.xml.dtdparser.DTDEventListener.setDocumentLocator.

Annotations
@Override
startContentModelback to summary
public void startContentModel(String elementName, short contentModelType) throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.startContentModel.

Implements com.sun.xml.dtdparser.DTDEventListener.startContentModel.

Doc from com.sun.xml.dtdparser.DTDEventListener.startContentModel.

receives notification that parsing of content model is beginning.

Annotations
@Override
Exceptions
SAXException:
for errors
startDTDback to summary
public void startDTD(InputEntity entity) throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.startDTD.

Implements com.sun.xml.dtdparser.DTDEventListener.startDTD.

Doc from com.sun.xml.dtdparser.DTDEventListener.startDTD.

Receive notification of the beginning of the DTD.

Annotations
@Override
Exceptions
SAXException:
for errors
startModelGroupback to summary
public void startModelGroup() throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.startModelGroup.

Implements com.sun.xml.dtdparser.DTDEventListener.startModelGroup.

Annotations
@Override
warningback to summary
public void warning(SAXParseException e) throws SAXException

Overrides com.sun.xml.dtdparser.DTDHandlerBase.warning.

Implements com.sun.xml.dtdparser.DTDEventListener.warning.

Annotations
@Override
com.sun.tools.xjc.reader.dtd back to summary

private Interface TDTDReader.InterfaceAcceptor


Method Summary

Modifier and TypeMethod and Description
public void

Method Detail

implementback to summary
public void implement(JClass c)