Class ElementTemplate
- All Implemented Interfaces:
ToplevelTemplate
(Parsers and access methods for the content are generated in TypedDOMGenerator
,
for the attributes in TypedAttrsGenerator
.)
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.bandm.tools.tdom.ContainerTemplate
ContainerTemplate.ContentModelRenderer, ContainerTemplate.ContentProperties
-
Field Summary
Modifier and TypeFieldDescriptionKeys are the original dtd name.(package private) MetaType
(package private) DocumentTemplate
(package private) final DTD.Element
The original definition of this element.(package private) boolean
(package private) String
(package private) static final Format
(package private) static final Format
(package private) boolean
(package private) final boolean
DOCME(package private) static final MetaType
(package private) static final MetaType
(package private) final NamespaceName
(package private) @Opt GeneratedConstructor
Survey on all GeneratedConstructor-s:(package private) @Opt GeneratedConstructor
Survey on all GeneratedConstructor-s:(package private) @Opt GeneratedConstructor
Survey on all GeneratedConstructor-s:contains the field names of formattr_[xxx]
.(package private) @Opt GeneratedConstructor
Survey on all GeneratedConstructor-s:(package private) @Opt GeneratedConstructor
Survey on all GeneratedConstructor-s:Accumulator for the generated semi-parser code.(package private) @Opt GeneratedConstructor
Survey on all GeneratedConstructor-s:(package private) final int
DOCME(package private) final String
(package private) GeneratedField
Field in the generated code of the element which holds the tag of the element, das defined in the DTD.(package private) @Opt GeneratedConstructor
Survey on all GeneratedConstructor-s:Fields inherited from class eu.bandm.tools.tdom.ContainerTemplate
childIndex, children, decodeMethod, disambigConstructor, disambigConstructorSafe, dumpElementsMethod, dumpMethod, elementTemplate, encodeMethod, innerContainerPrefix, mandatoryDirector, numbering, optionalDirector, parentContainer, setMethod, typedConstructor, untypedConstructor, visitMethod
Fields inherited from class eu.bandm.tools.tdom.NodeTemplate
actionMethod, decodeClosure, getDecodeClosure, getParseClosure, nodeClass, packageTemplate, parseClosure, parseSAX, parseSAXArguments, parseSAXAttributes, semiparseArguments, semiparseStatements, usingSemiparser
-
Constructor Summary
ConstructorDescriptionElementTemplate
(PackageTemplate packageTemplate, DTD.Element element, NamespaceName nname, boolean isPublic) -
Method Summary
Modifier and TypeMethodDescription(package private) void
addAttribute
(String fieldname, MetaClass cls) ATTENTION @param fieldname is the original DTD name(package private) void
addAttributeInfo
(MetaClass ainfo) (package private) void
addRequiredAttribute
(String fieldname) ATTENTION @param fieldname is a mangling result "attr_"+makeJavaName().(package private) void
void
void
finish()
Called from PackageTemplate.finish()protected void
Called byContainerTemplate.finish()
.protected GeneratedMethod
protected GeneratedMethod
protected GeneratedMethod
protected void
protected void
(package private) void
protected GeneratedConstructor
The "typed constructor" has the same signature as theset(...)
method, namely what corresponds correctly to the content model (notwithstanding null-checks and array length.)protected GeneratedConstructor
The "untyped constructor" requires a tdom object and is NORMALLY NOT visible to/callable by the programmer.protected GeneratedMethod
For TypedSequence, TypedChoice, TypedAlt.(package private) boolean
getName()
protected String
protected void
void
init()
void
init2
(TypedAttrsGenerator typedAttrsGenerator) Second part of initialization.boolean
restrictSafeFlags
(boolean java, boolean saxDom) (package private) void
setContentClass
(MetaType contentClass) protected void
(package private) void
setIdAttribute
(String idAttribute) Methods inherited from class eu.bandm.tools.tdom.ContainerTemplate
addAttrDescendStatement, addChild, addDecodeArgument, addDescendStatement, addDescendStatement, addVisitContentStatement, generateDecodeMethod, generateDecodeStatement, generateDumpElementsMethod, generateSetMethod, getNumber, internalSetDirectors, setNumbering, useSemiparser
Methods inherited from class eu.bandm.tools.tdom.NodeTemplate
addGeneralizeParent, addLookaheadSAXStatement, addLookaheadSAXStatement, addLookaheadSemiparseStatement, addLookaheadSemiparseStatement, addParseSAXArgument, addParseSAXArgument, addParseSAXAttribute, addParseSAXStatement, addSemiparseArgument, addSemiparseArgument, addSemiparseStatement, generateActionMethod, generateDecodeClosure, generateHostMethod, generateMatchWithMethod, generateMatchWithMethod, generateParseClosure, generateSAXParser, generateSemiparser_includingAlt, getNodeClass, parseSAXArguments_asFormat
Methods inherited from class eu.bandm.tools.tdom.Template
error, error, expression, statement, statements, warning, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface eu.bandm.tools.tdom.ToplevelTemplate
propagateSafeAttributeFlags
-
Field Details
-
element
The original definition of this element. -
nname
-
tagName
-
tagIndex
final int tagIndexDOCME -
isPublic
final boolean isPublicDOCME -
tagNameField
GeneratedField tagNameFieldField in the generated code of the element which holds the tag of the element, das defined in the DTD. -
hasAtts
boolean hasAtts -
isEmpty
boolean isEmpty -
parsingConstructor
Survey on all GeneratedConstructor-s:
The constructors in AbstractElementTemplate are nearly parameterless and only needed for the UPWARD chain from a particular model element class via abstract elements and package.Element to tdom.runtime.TypedElement. They use only the name parameter. (WHY? IS KNOWN STATIC !?!?!) Thus they throw nothing.
typedConstructor = new Element(NamespaceName) untypedConstructor = new Element(W3CDOM)
Further irrelevant GeneratedConstructor-s:
one in DTDTemplate ("new DTD(MsgRcv)")
two in DumperTemplate (ContentHandler plus LexicalHandler)Most GeneratedConstructor are built when TypedDOMGenerator visits the content models, and must be accessible when "finish" generates API documentation.
S=shallow D=descending | live on C=Container/E=Element Template | | X=ContentModelException | | | S=AttributeSyntaxExc(iff approp) | | | M=AttributeMissingExc(iff approp) | | | AX=AttributeExc iff any Att present typedConstructor = new Ele/CP(C1,C2,C3) S C SM typedConstructorSafe = new Ele/CP(SV,C1,..) S E M untypedConstructor = new Element(w3cDom..) D C X AX new Seq(CntMap..) D C X AX parsingConstructor = new Element(CntMap..) S E X AX INTERNAL ONLY "C"-->FIXME CHECK disambigConstructor = new Ele/CP() S C M disambigConstructorSafe = new Ele(SF) S C M semiparsingConstructor = new E(SaxAtt,E..) S E X SM semiparsingConstructorConstructorShort = new E(E..) S E X M pcdataOnlyConstructor=new E(String) S E SM (built in TypedDOMGenerator !?) CntMap=ContentMap Ele/CP=Element or Choice or Sequence SV=SafeValues-flag SaxAtt = SAX.Attributes ADDITIONAL for the mixed content case there are pcdataEmptyConstructor=new E() = disambigConstructor pcdataEmptyConstructorSafe =new E(SV) = disambigConstructorSafe pcdataOnlyConstructor =new E(String) pcdataOnlyConstructorSafe =new E(SV, String)
The "..Safe" variants are generated ONLY if there are unsafe attributes.The constructors of the generated common "Document" superclass is trivial and invokes the constructors of the runtime class with the DTD class as only argument.
Some of the constructors in the generated "Document_[XY]" classes initiate parsing:S=shallow D=descending | | X=ContentModelException | | S=AttributeSyntaxExc(iff approp) | | M=AttributeMissingExc(iff approp) | | AX=AttributeExc iff any Att present typedConstructor = new Doc_[XY](Element) S untypedConstructor = new Doc_[XY](w3cDom..) D X AX saxConstructor = new Doc_[XY](SaxStr) D X AX (SaxStr=SAXEventStream) decodeConstructor = new Doc_[XY](JIS) D X AX (JIS=java.io.InputStream)
The "ContentClass" classes generated for MIXED content get one constructor for each possible element type, and one for pcdata (=String), and one common with the altIndex as parameter.
(( Additionally there is a "FactoryConstructor" ??? DOCME ))Closely related to the constructors are the parse() and decode() methods and their signatures. MORE TO COME DOCME
---------------------------------------------------------------
Generating constructors: (ml 20170727) The DOM and SAX constructors and parsers are not used with fine granularity, so they can follow a global decision: Iff there is any one attribute contained in the DTD, they declare to throw TdomAttributeException.
typedConstructor, untypedConstructor and disambigConstructor are defined on the super class level, They do ALWAYS exist and are also used for Choice and Sequence.
The other constructors live only in this code file.
"untypedConstructor" has parameters: (DOM-element, ext, listener). It is PRIVATE, used by parse(DOM-element...) which is NOT VISIBLE in api doc, but has package scope. The user method for parsing DOM objects is finallyDTD.[FIXME]
.
"typedConstructor" has parameters: (complete content model copied from "set(..)" method).
It is public and presented to the user. It does not throwTdomContentException
, but possiblyTdomAttributeException
.
"semiparsingConstructor" has a optional SAX ATTRIBUTE LIST and a sequence of/Element. It can throw content and attribute exceptions
"semiparsingConstructorShort" is a shortcut with no sax attribute list.
"parsingConstructor" has ContentMapping, Extension, Listener. It is INTERNAL ONLY and used by FIXME ASK BT
"disambigConstructor" is needed iff zero-length content is possible but not necessary, as in case of "MIXED" content. It treats the empty case explcitly. This is necessary because otherwise the empty signature would be ambigious between "typed" and "untyped" and rejected when compiling the applying code.
pcdataOnlyConstructor convenience constructor accepting one string. (Is built in TypedDOMGenerator) -
pcdataOnlyConstructor
Survey on all GeneratedConstructor-s:
The constructors in AbstractElementTemplate are nearly parameterless and only needed for the UPWARD chain from a particular model element class via abstract elements and package.Element to tdom.runtime.TypedElement. They use only the name parameter. (WHY? IS KNOWN STATIC !?!?!) Thus they throw nothing.
typedConstructor = new Element(NamespaceName) untypedConstructor = new Element(W3CDOM)
Further irrelevant GeneratedConstructor-s:
one in DTDTemplate ("new DTD(MsgRcv)")
two in DumperTemplate (ContentHandler plus LexicalHandler)Most GeneratedConstructor are built when TypedDOMGenerator visits the content models, and must be accessible when "finish" generates API documentation.
S=shallow D=descending | live on C=Container/E=Element Template | | X=ContentModelException | | | S=AttributeSyntaxExc(iff approp) | | | M=AttributeMissingExc(iff approp) | | | AX=AttributeExc iff any Att present typedConstructor = new Ele/CP(C1,C2,C3) S C SM typedConstructorSafe = new Ele/CP(SV,C1,..) S E M untypedConstructor = new Element(w3cDom..) D C X AX new Seq(CntMap..) D C X AX parsingConstructor = new Element(CntMap..) S E X AX INTERNAL ONLY "C"-->FIXME CHECK disambigConstructor = new Ele/CP() S C M disambigConstructorSafe = new Ele(SF) S C M semiparsingConstructor = new E(SaxAtt,E..) S E X SM semiparsingConstructorConstructorShort = new E(E..) S E X M pcdataOnlyConstructor=new E(String) S E SM (built in TypedDOMGenerator !?) CntMap=ContentMap Ele/CP=Element or Choice or Sequence SV=SafeValues-flag SaxAtt = SAX.Attributes ADDITIONAL for the mixed content case there are pcdataEmptyConstructor=new E() = disambigConstructor pcdataEmptyConstructorSafe =new E(SV) = disambigConstructorSafe pcdataOnlyConstructor =new E(String) pcdataOnlyConstructorSafe =new E(SV, String)
The "..Safe" variants are generated ONLY if there are unsafe attributes.The constructors of the generated common "Document" superclass is trivial and invokes the constructors of the runtime class with the DTD class as only argument.
Some of the constructors in the generated "Document_[XY]" classes initiate parsing:S=shallow D=descending | | X=ContentModelException | | S=AttributeSyntaxExc(iff approp) | | M=AttributeMissingExc(iff approp) | | AX=AttributeExc iff any Att present typedConstructor = new Doc_[XY](Element) S untypedConstructor = new Doc_[XY](w3cDom..) D X AX saxConstructor = new Doc_[XY](SaxStr) D X AX (SaxStr=SAXEventStream) decodeConstructor = new Doc_[XY](JIS) D X AX (JIS=java.io.InputStream)
The "ContentClass" classes generated for MIXED content get one constructor for each possible element type, and one for pcdata (=String), and one common with the altIndex as parameter.
(( Additionally there is a "FactoryConstructor" ??? DOCME ))Closely related to the constructors are the parse() and decode() methods and their signatures. MORE TO COME DOCME
---------------------------------------------------------------
Generating constructors: (ml 20170727) The DOM and SAX constructors and parsers are not used with fine granularity, so they can follow a global decision: Iff there is any one attribute contained in the DTD, they declare to throw TdomAttributeException.
typedConstructor, untypedConstructor and disambigConstructor are defined on the super class level, They do ALWAYS exist and are also used for Choice and Sequence.
The other constructors live only in this code file.
"untypedConstructor" has parameters: (DOM-element, ext, listener). It is PRIVATE, used by parse(DOM-element...) which is NOT VISIBLE in api doc, but has package scope. The user method for parsing DOM objects is finallyDTD.[FIXME]
.
"typedConstructor" has parameters: (complete content model copied from "set(..)" method).
It is public and presented to the user. It does not throwTdomContentException
, but possiblyTdomAttributeException
.
"semiparsingConstructor" has a optional SAX ATTRIBUTE LIST and a sequence of/Element. It can throw content and attribute exceptions
"semiparsingConstructorShort" is a shortcut with no sax attribute list.
"parsingConstructor" has ContentMapping, Extension, Listener. It is INTERNAL ONLY and used by FIXME ASK BT
"disambigConstructor" is needed iff zero-length content is possible but not necessary, as in case of "MIXED" content. It treats the empty case explcitly. This is necessary because otherwise the empty signature would be ambigious between "typed" and "untyped" and rejected when compiling the applying code.
pcdataOnlyConstructor convenience constructor accepting one string. (Is built in TypedDOMGenerator) -
pcdataOnlyConstructorSafe
Survey on all GeneratedConstructor-s:
The constructors in AbstractElementTemplate are nearly parameterless and only needed for the UPWARD chain from a particular model element class via abstract elements and package.Element to tdom.runtime.TypedElement. They use only the name parameter. (WHY? IS KNOWN STATIC !?!?!) Thus they throw nothing.
typedConstructor = new Element(NamespaceName) untypedConstructor = new Element(W3CDOM)
Further irrelevant GeneratedConstructor-s:
one in DTDTemplate ("new DTD(MsgRcv)")
two in DumperTemplate (ContentHandler plus LexicalHandler)Most GeneratedConstructor are built when TypedDOMGenerator visits the content models, and must be accessible when "finish" generates API documentation.
S=shallow D=descending | live on C=Container/E=Element Template | | X=ContentModelException | | | S=AttributeSyntaxExc(iff approp) | | | M=AttributeMissingExc(iff approp) | | | AX=AttributeExc iff any Att present typedConstructor = new Ele/CP(C1,C2,C3) S C SM typedConstructorSafe = new Ele/CP(SV,C1,..) S E M untypedConstructor = new Element(w3cDom..) D C X AX new Seq(CntMap..) D C X AX parsingConstructor = new Element(CntMap..) S E X AX INTERNAL ONLY "C"-->FIXME CHECK disambigConstructor = new Ele/CP() S C M disambigConstructorSafe = new Ele(SF) S C M semiparsingConstructor = new E(SaxAtt,E..) S E X SM semiparsingConstructorConstructorShort = new E(E..) S E X M pcdataOnlyConstructor=new E(String) S E SM (built in TypedDOMGenerator !?) CntMap=ContentMap Ele/CP=Element or Choice or Sequence SV=SafeValues-flag SaxAtt = SAX.Attributes ADDITIONAL for the mixed content case there are pcdataEmptyConstructor=new E() = disambigConstructor pcdataEmptyConstructorSafe =new E(SV) = disambigConstructorSafe pcdataOnlyConstructor =new E(String) pcdataOnlyConstructorSafe =new E(SV, String)
The "..Safe" variants are generated ONLY if there are unsafe attributes.The constructors of the generated common "Document" superclass is trivial and invokes the constructors of the runtime class with the DTD class as only argument.
Some of the constructors in the generated "Document_[XY]" classes initiate parsing:S=shallow D=descending | | X=ContentModelException | | S=AttributeSyntaxExc(iff approp) | | M=AttributeMissingExc(iff approp) | | AX=AttributeExc iff any Att present typedConstructor = new Doc_[XY](Element) S untypedConstructor = new Doc_[XY](w3cDom..) D X AX saxConstructor = new Doc_[XY](SaxStr) D X AX (SaxStr=SAXEventStream) decodeConstructor = new Doc_[XY](JIS) D X AX (JIS=java.io.InputStream)
The "ContentClass" classes generated for MIXED content get one constructor for each possible element type, and one for pcdata (=String), and one common with the altIndex as parameter.
(( Additionally there is a "FactoryConstructor" ??? DOCME ))Closely related to the constructors are the parse() and decode() methods and their signatures. MORE TO COME DOCME
---------------------------------------------------------------
Generating constructors: (ml 20170727) The DOM and SAX constructors and parsers are not used with fine granularity, so they can follow a global decision: Iff there is any one attribute contained in the DTD, they declare to throw TdomAttributeException.
typedConstructor, untypedConstructor and disambigConstructor are defined on the super class level, They do ALWAYS exist and are also used for Choice and Sequence.
The other constructors live only in this code file.
"untypedConstructor" has parameters: (DOM-element, ext, listener). It is PRIVATE, used by parse(DOM-element...) which is NOT VISIBLE in api doc, but has package scope. The user method for parsing DOM objects is finallyDTD.[FIXME]
.
"typedConstructor" has parameters: (complete content model copied from "set(..)" method).
It is public and presented to the user. It does not throwTdomContentException
, but possiblyTdomAttributeException
.
"semiparsingConstructor" has a optional SAX ATTRIBUTE LIST and a sequence of/Element. It can throw content and attribute exceptions
"semiparsingConstructorShort" is a shortcut with no sax attribute list.
"parsingConstructor" has ContentMapping, Extension, Listener. It is INTERNAL ONLY and used by FIXME ASK BT
"disambigConstructor" is needed iff zero-length content is possible but not necessary, as in case of "MIXED" content. It treats the empty case explcitly. This is necessary because otherwise the empty signature would be ambigious between "typed" and "untyped" and rejected when compiling the applying code.
pcdataOnlyConstructor convenience constructor accepting one string. (Is built in TypedDOMGenerator) -
semiparsingPreConstructor
Survey on all GeneratedConstructor-s:
The constructors in AbstractElementTemplate are nearly parameterless and only needed for the UPWARD chain from a particular model element class via abstract elements and package.Element to tdom.runtime.TypedElement. They use only the name parameter. (WHY? IS KNOWN STATIC !?!?!) Thus they throw nothing.
typedConstructor = new Element(NamespaceName) untypedConstructor = new Element(W3CDOM)
Further irrelevant GeneratedConstructor-s:
one in DTDTemplate ("new DTD(MsgRcv)")
two in DumperTemplate (ContentHandler plus LexicalHandler)Most GeneratedConstructor are built when TypedDOMGenerator visits the content models, and must be accessible when "finish" generates API documentation.
S=shallow D=descending | live on C=Container/E=Element Template | | X=ContentModelException | | | S=AttributeSyntaxExc(iff approp) | | | M=AttributeMissingExc(iff approp) | | | AX=AttributeExc iff any Att present typedConstructor = new Ele/CP(C1,C2,C3) S C SM typedConstructorSafe = new Ele/CP(SV,C1,..) S E M untypedConstructor = new Element(w3cDom..) D C X AX new Seq(CntMap..) D C X AX parsingConstructor = new Element(CntMap..) S E X AX INTERNAL ONLY "C"-->FIXME CHECK disambigConstructor = new Ele/CP() S C M disambigConstructorSafe = new Ele(SF) S C M semiparsingConstructor = new E(SaxAtt,E..) S E X SM semiparsingConstructorConstructorShort = new E(E..) S E X M pcdataOnlyConstructor=new E(String) S E SM (built in TypedDOMGenerator !?) CntMap=ContentMap Ele/CP=Element or Choice or Sequence SV=SafeValues-flag SaxAtt = SAX.Attributes ADDITIONAL for the mixed content case there are pcdataEmptyConstructor=new E() = disambigConstructor pcdataEmptyConstructorSafe =new E(SV) = disambigConstructorSafe pcdataOnlyConstructor =new E(String) pcdataOnlyConstructorSafe =new E(SV, String)
The "..Safe" variants are generated ONLY if there are unsafe attributes.The constructors of the generated common "Document" superclass is trivial and invokes the constructors of the runtime class with the DTD class as only argument.
Some of the constructors in the generated "Document_[XY]" classes initiate parsing:S=shallow D=descending | | X=ContentModelException | | S=AttributeSyntaxExc(iff approp) | | M=AttributeMissingExc(iff approp) | | AX=AttributeExc iff any Att present typedConstructor = new Doc_[XY](Element) S untypedConstructor = new Doc_[XY](w3cDom..) D X AX saxConstructor = new Doc_[XY](SaxStr) D X AX (SaxStr=SAXEventStream) decodeConstructor = new Doc_[XY](JIS) D X AX (JIS=java.io.InputStream)
The "ContentClass" classes generated for MIXED content get one constructor for each possible element type, and one for pcdata (=String), and one common with the altIndex as parameter.
(( Additionally there is a "FactoryConstructor" ??? DOCME ))Closely related to the constructors are the parse() and decode() methods and their signatures. MORE TO COME DOCME
---------------------------------------------------------------
Generating constructors: (ml 20170727) The DOM and SAX constructors and parsers are not used with fine granularity, so they can follow a global decision: Iff there is any one attribute contained in the DTD, they declare to throw TdomAttributeException.
typedConstructor, untypedConstructor and disambigConstructor are defined on the super class level, They do ALWAYS exist and are also used for Choice and Sequence.
The other constructors live only in this code file.
"untypedConstructor" has parameters: (DOM-element, ext, listener). It is PRIVATE, used by parse(DOM-element...) which is NOT VISIBLE in api doc, but has package scope. The user method for parsing DOM objects is finallyDTD.[FIXME]
.
"typedConstructor" has parameters: (complete content model copied from "set(..)" method).
It is public and presented to the user. It does not throwTdomContentException
, but possiblyTdomAttributeException
.
"semiparsingConstructor" has a optional SAX ATTRIBUTE LIST and a sequence of/Element. It can throw content and attribute exceptions
"semiparsingConstructorShort" is a shortcut with no sax attribute list.
"parsingConstructor" has ContentMapping, Extension, Listener. It is INTERNAL ONLY and used by FIXME ASK BT
"disambigConstructor" is needed iff zero-length content is possible but not necessary, as in case of "MIXED" content. It treats the empty case explcitly. This is necessary because otherwise the empty signature would be ambigious between "typed" and "untyped" and rejected when compiling the applying code.
pcdataOnlyConstructor convenience constructor accepting one string. (Is built in TypedDOMGenerator) -
semiparsingConstructor
Survey on all GeneratedConstructor-s:
The constructors in AbstractElementTemplate are nearly parameterless and only needed for the UPWARD chain from a particular model element class via abstract elements and package.Element to tdom.runtime.TypedElement. They use only the name parameter. (WHY? IS KNOWN STATIC !?!?!) Thus they throw nothing.
typedConstructor = new Element(NamespaceName) untypedConstructor = new Element(W3CDOM)
Further irrelevant GeneratedConstructor-s:
one in DTDTemplate ("new DTD(MsgRcv)")
two in DumperTemplate (ContentHandler plus LexicalHandler)Most GeneratedConstructor are built when TypedDOMGenerator visits the content models, and must be accessible when "finish" generates API documentation.
S=shallow D=descending | live on C=Container/E=Element Template | | X=ContentModelException | | | S=AttributeSyntaxExc(iff approp) | | | M=AttributeMissingExc(iff approp) | | | AX=AttributeExc iff any Att present typedConstructor = new Ele/CP(C1,C2,C3) S C SM typedConstructorSafe = new Ele/CP(SV,C1,..) S E M untypedConstructor = new Element(w3cDom..) D C X AX new Seq(CntMap..) D C X AX parsingConstructor = new Element(CntMap..) S E X AX INTERNAL ONLY "C"-->FIXME CHECK disambigConstructor = new Ele/CP() S C M disambigConstructorSafe = new Ele(SF) S C M semiparsingConstructor = new E(SaxAtt,E..) S E X SM semiparsingConstructorConstructorShort = new E(E..) S E X M pcdataOnlyConstructor=new E(String) S E SM (built in TypedDOMGenerator !?) CntMap=ContentMap Ele/CP=Element or Choice or Sequence SV=SafeValues-flag SaxAtt = SAX.Attributes ADDITIONAL for the mixed content case there are pcdataEmptyConstructor=new E() = disambigConstructor pcdataEmptyConstructorSafe =new E(SV) = disambigConstructorSafe pcdataOnlyConstructor =new E(String) pcdataOnlyConstructorSafe =new E(SV, String)
The "..Safe" variants are generated ONLY if there are unsafe attributes.The constructors of the generated common "Document" superclass is trivial and invokes the constructors of the runtime class with the DTD class as only argument.
Some of the constructors in the generated "Document_[XY]" classes initiate parsing:S=shallow D=descending | | X=ContentModelException | | S=AttributeSyntaxExc(iff approp) | | M=AttributeMissingExc(iff approp) | | AX=AttributeExc iff any Att present typedConstructor = new Doc_[XY](Element) S untypedConstructor = new Doc_[XY](w3cDom..) D X AX saxConstructor = new Doc_[XY](SaxStr) D X AX (SaxStr=SAXEventStream) decodeConstructor = new Doc_[XY](JIS) D X AX (JIS=java.io.InputStream)
The "ContentClass" classes generated for MIXED content get one constructor for each possible element type, and one for pcdata (=String), and one common with the altIndex as parameter.
(( Additionally there is a "FactoryConstructor" ??? DOCME ))Closely related to the constructors are the parse() and decode() methods and their signatures. MORE TO COME DOCME
---------------------------------------------------------------
Generating constructors: (ml 20170727) The DOM and SAX constructors and parsers are not used with fine granularity, so they can follow a global decision: Iff there is any one attribute contained in the DTD, they declare to throw TdomAttributeException.
typedConstructor, untypedConstructor and disambigConstructor are defined on the super class level, They do ALWAYS exist and are also used for Choice and Sequence.
The other constructors live only in this code file.
"untypedConstructor" has parameters: (DOM-element, ext, listener). It is PRIVATE, used by parse(DOM-element...) which is NOT VISIBLE in api doc, but has package scope. The user method for parsing DOM objects is finallyDTD.[FIXME]
.
"typedConstructor" has parameters: (complete content model copied from "set(..)" method).
It is public and presented to the user. It does not throwTdomContentException
, but possiblyTdomAttributeException
.
"semiparsingConstructor" has a optional SAX ATTRIBUTE LIST and a sequence of/Element. It can throw content and attribute exceptions
"semiparsingConstructorShort" is a shortcut with no sax attribute list.
"parsingConstructor" has ContentMapping, Extension, Listener. It is INTERNAL ONLY and used by FIXME ASK BT
"disambigConstructor" is needed iff zero-length content is possible but not necessary, as in case of "MIXED" content. It treats the empty case explcitly. This is necessary because otherwise the empty signature would be ambigious between "typed" and "untyped" and rejected when compiling the applying code.
pcdataOnlyConstructor convenience constructor accepting one string. (Is built in TypedDOMGenerator) -
semiparsingConstructorShort
Survey on all GeneratedConstructor-s:
The constructors in AbstractElementTemplate are nearly parameterless and only needed for the UPWARD chain from a particular model element class via abstract elements and package.Element to tdom.runtime.TypedElement. They use only the name parameter. (WHY? IS KNOWN STATIC !?!?!) Thus they throw nothing.
typedConstructor = new Element(NamespaceName) untypedConstructor = new Element(W3CDOM)
Further irrelevant GeneratedConstructor-s:
one in DTDTemplate ("new DTD(MsgRcv)")
two in DumperTemplate (ContentHandler plus LexicalHandler)Most GeneratedConstructor are built when TypedDOMGenerator visits the content models, and must be accessible when "finish" generates API documentation.
S=shallow D=descending | live on C=Container/E=Element Template | | X=ContentModelException | | | S=AttributeSyntaxExc(iff approp) | | | M=AttributeMissingExc(iff approp) | | | AX=AttributeExc iff any Att present typedConstructor = new Ele/CP(C1,C2,C3) S C SM typedConstructorSafe = new Ele/CP(SV,C1,..) S E M untypedConstructor = new Element(w3cDom..) D C X AX new Seq(CntMap..) D C X AX parsingConstructor = new Element(CntMap..) S E X AX INTERNAL ONLY "C"-->FIXME CHECK disambigConstructor = new Ele/CP() S C M disambigConstructorSafe = new Ele(SF) S C M semiparsingConstructor = new E(SaxAtt,E..) S E X SM semiparsingConstructorConstructorShort = new E(E..) S E X M pcdataOnlyConstructor=new E(String) S E SM (built in TypedDOMGenerator !?) CntMap=ContentMap Ele/CP=Element or Choice or Sequence SV=SafeValues-flag SaxAtt = SAX.Attributes ADDITIONAL for the mixed content case there are pcdataEmptyConstructor=new E() = disambigConstructor pcdataEmptyConstructorSafe =new E(SV) = disambigConstructorSafe pcdataOnlyConstructor =new E(String) pcdataOnlyConstructorSafe =new E(SV, String)
The "..Safe" variants are generated ONLY if there are unsafe attributes.The constructors of the generated common "Document" superclass is trivial and invokes the constructors of the runtime class with the DTD class as only argument.
Some of the constructors in the generated "Document_[XY]" classes initiate parsing:S=shallow D=descending | | X=ContentModelException | | S=AttributeSyntaxExc(iff approp) | | M=AttributeMissingExc(iff approp) | | AX=AttributeExc iff any Att present typedConstructor = new Doc_[XY](Element) S untypedConstructor = new Doc_[XY](w3cDom..) D X AX saxConstructor = new Doc_[XY](SaxStr) D X AX (SaxStr=SAXEventStream) decodeConstructor = new Doc_[XY](JIS) D X AX (JIS=java.io.InputStream)
The "ContentClass" classes generated for MIXED content get one constructor for each possible element type, and one for pcdata (=String), and one common with the altIndex as parameter.
(( Additionally there is a "FactoryConstructor" ??? DOCME ))Closely related to the constructors are the parse() and decode() methods and their signatures. MORE TO COME DOCME
---------------------------------------------------------------
Generating constructors: (ml 20170727) The DOM and SAX constructors and parsers are not used with fine granularity, so they can follow a global decision: Iff there is any one attribute contained in the DTD, they declare to throw TdomAttributeException.
typedConstructor, untypedConstructor and disambigConstructor are defined on the super class level, They do ALWAYS exist and are also used for Choice and Sequence.
The other constructors live only in this code file.
"untypedConstructor" has parameters: (DOM-element, ext, listener). It is PRIVATE, used by parse(DOM-element...) which is NOT VISIBLE in api doc, but has package scope. The user method for parsing DOM objects is finallyDTD.[FIXME]
.
"typedConstructor" has parameters: (complete content model copied from "set(..)" method).
It is public and presented to the user. It does not throwTdomContentException
, but possiblyTdomAttributeException
.
"semiparsingConstructor" has a optional SAX ATTRIBUTE LIST and a sequence of/Element. It can throw content and attribute exceptions
"semiparsingConstructorShort" is a shortcut with no sax attribute list.
"parsingConstructor" has ContentMapping, Extension, Listener. It is INTERNAL ONLY and used by FIXME ASK BT
"disambigConstructor" is needed iff zero-length content is possible but not necessary, as in case of "MIXED" content. It treats the empty case explcitly. This is necessary because otherwise the empty signature would be ambigious between "typed" and "untyped" and rejected when compiling the applying code.
pcdataOnlyConstructor convenience constructor accepting one string. (Is built in TypedDOMGenerator) -
typedConstructorSafe
Survey on all GeneratedConstructor-s:
The constructors in AbstractElementTemplate are nearly parameterless and only needed for the UPWARD chain from a particular model element class via abstract elements and package.Element to tdom.runtime.TypedElement. They use only the name parameter. (WHY? IS KNOWN STATIC !?!?!) Thus they throw nothing.
typedConstructor = new Element(NamespaceName) untypedConstructor = new Element(W3CDOM)
Further irrelevant GeneratedConstructor-s:
one in DTDTemplate ("new DTD(MsgRcv)")
two in DumperTemplate (ContentHandler plus LexicalHandler)Most GeneratedConstructor are built when TypedDOMGenerator visits the content models, and must be accessible when "finish" generates API documentation.
S=shallow D=descending | live on C=Container/E=Element Template | | X=ContentModelException | | | S=AttributeSyntaxExc(iff approp) | | | M=AttributeMissingExc(iff approp) | | | AX=AttributeExc iff any Att present typedConstructor = new Ele/CP(C1,C2,C3) S C SM typedConstructorSafe = new Ele/CP(SV,C1,..) S E M untypedConstructor = new Element(w3cDom..) D C X AX new Seq(CntMap..) D C X AX parsingConstructor = new Element(CntMap..) S E X AX INTERNAL ONLY "C"-->FIXME CHECK disambigConstructor = new Ele/CP() S C M disambigConstructorSafe = new Ele(SF) S C M semiparsingConstructor = new E(SaxAtt,E..) S E X SM semiparsingConstructorConstructorShort = new E(E..) S E X M pcdataOnlyConstructor=new E(String) S E SM (built in TypedDOMGenerator !?) CntMap=ContentMap Ele/CP=Element or Choice or Sequence SV=SafeValues-flag SaxAtt = SAX.Attributes ADDITIONAL for the mixed content case there are pcdataEmptyConstructor=new E() = disambigConstructor pcdataEmptyConstructorSafe =new E(SV) = disambigConstructorSafe pcdataOnlyConstructor =new E(String) pcdataOnlyConstructorSafe =new E(SV, String)
The "..Safe" variants are generated ONLY if there are unsafe attributes.The constructors of the generated common "Document" superclass is trivial and invokes the constructors of the runtime class with the DTD class as only argument.
Some of the constructors in the generated "Document_[XY]" classes initiate parsing:S=shallow D=descending | | X=ContentModelException | | S=AttributeSyntaxExc(iff approp) | | M=AttributeMissingExc(iff approp) | | AX=AttributeExc iff any Att present typedConstructor = new Doc_[XY](Element) S untypedConstructor = new Doc_[XY](w3cDom..) D X AX saxConstructor = new Doc_[XY](SaxStr) D X AX (SaxStr=SAXEventStream) decodeConstructor = new Doc_[XY](JIS) D X AX (JIS=java.io.InputStream)
The "ContentClass" classes generated for MIXED content get one constructor for each possible element type, and one for pcdata (=String), and one common with the altIndex as parameter.
(( Additionally there is a "FactoryConstructor" ??? DOCME ))Closely related to the constructors are the parse() and decode() methods and their signatures. MORE TO COME DOCME
---------------------------------------------------------------
Generating constructors: (ml 20170727) The DOM and SAX constructors and parsers are not used with fine granularity, so they can follow a global decision: Iff there is any one attribute contained in the DTD, they declare to throw TdomAttributeException.
typedConstructor, untypedConstructor and disambigConstructor are defined on the super class level, They do ALWAYS exist and are also used for Choice and Sequence.
The other constructors live only in this code file.
"untypedConstructor" has parameters: (DOM-element, ext, listener). It is PRIVATE, used by parse(DOM-element...) which is NOT VISIBLE in api doc, but has package scope. The user method for parsing DOM objects is finallyDTD.[FIXME]
.
"typedConstructor" has parameters: (complete content model copied from "set(..)" method).
It is public and presented to the user. It does not throwTdomContentException
, but possiblyTdomAttributeException
.
"semiparsingConstructor" has a optional SAX ATTRIBUTE LIST and a sequence of/Element. It can throw content and attribute exceptions
"semiparsingConstructorShort" is a shortcut with no sax attribute list.
"parsingConstructor" has ContentMapping, Extension, Listener. It is INTERNAL ONLY and used by FIXME ASK BT
"disambigConstructor" is needed iff zero-length content is possible but not necessary, as in case of "MIXED" content. It treats the empty case explcitly. This is necessary because otherwise the empty signature would be ambigious between "typed" and "untyped" and rejected when compiling the applying code.
pcdataOnlyConstructor convenience constructor accepting one string. (Is built in TypedDOMGenerator) -
contentClass
MetaType contentClass -
documentTemplate
DocumentTemplate documentTemplate -
idAttribute
String idAttribute -
locationClass
-
listOfEthereals
-
initMethodComment
-
initMethod2Comment
-
semiparsingConstructorStatements
Accumulator for the generated semi-parser code. -
requiredAttributes
contains the field names of formattr_[xxx]
. Has been filled byTypedAttrsGenerator
in "processOneAttDef" by invokingaddRequiredAttribute(String)
. -
allAttributes
Keys are the original dtd name. This info is only needed for documentation text generation. Has been filled byTypedAttrsGenerator
in "processOneAttDef" by invokingaddAttribute(String,MetaClass)
.
-
-
Constructor Details
-
ElementTemplate
public ElementTemplate(PackageTemplate packageTemplate, DTD.Element element, NamespaceName nname, boolean isPublic)
-
-
Method Details
-
contentModel
- Specified by:
contentModel
in classContainerTemplate
-
getCaller
- Specified by:
getCaller
in interfaceToplevelTemplate
-
get_allAttrsJavaSafe
boolean get_allAttrsJavaSafe() -
restrictSafeFlags
public boolean restrictSafeFlags(boolean java, boolean saxDom) - Specified by:
restrictSafeFlags
in interfaceToplevelTemplate
-
giveTypedConstructorSafe
protected void giveTypedConstructorSafe() -
init
public void init()- Overrides:
init
in classContainerTemplate
-
init2
Second part of initialization. Is called from TypedDOMGenerator separately, because it needs "SelectedIntegersAttribute", which is set byTypedAttrsGenerator.prepareCommon(Dtd)
. -
finish
public void finish()Called from PackageTemplate.finish()- Overrides:
finish
in classContainerTemplate
-
getToplevelClass
- Specified by:
getToplevelClass
in interfaceToplevelTemplate
-
getName
- Specified by:
getName
in interfaceToplevelTemplate
-
getDocumentTemplate
- Specified by:
getDocumentTemplate
in interfaceToplevelTemplate
-
addTagIndexField
void addTagIndexField() -
generateVisitMethod
Description copied from class:ContainerTemplate
For TypedSequence, TypedChoice, TypedAlt.- Overrides:
generateVisitMethod
in classContainerTemplate
-
generateDumpMethod
- Overrides:
generateDumpMethod
in classContainerTemplate
-
requiredAttributesText
-
generateTypedConstructor
Description copied from class:ContainerTemplate
The "typed constructor" has the same signature as theset(...)
method, namely what corresponds correctly to the content model (notwithstanding null-checks and array length.)- Overrides:
generateTypedConstructor
in classContainerTemplate
-
generateUntypedConstructor
Description copied from class:ContainerTemplate
The "untyped constructor" requires a tdom object and is NORMALLY NOT visible to/callable by the programmer.- Overrides:
generateUntypedConstructor
in classContainerTemplate
-
generateParseMethod
- Overrides:
generateParseMethod
in classContainerTemplate
-
generateDeclComment
protected void generateDeclComment()Called byContainerTemplate.finish()
.- Overrides:
generateDeclComment
in classContainerTemplate
-
getVisiteeName
- Overrides:
getVisiteeName
in classNodeTemplate
-
generateEncodeMethod
- Overrides:
generateEncodeMethod
in classContainerTemplate
-
analyzeContent
public void analyzeContent() -
generateParseSAXAction
protected void generateParseSAXAction()- Overrides:
generateParseSAXAction
in classNodeTemplate
-
setDirectors
- Specified by:
setDirectors
in classContainerTemplate
-
setIdAttribute
-
generateSemiparser_nonAlt
- Overrides:
generateSemiparser_nonAlt
in classNodeTemplate
-
generateSemiparseAction
protected void generateSemiparseAction()- Overrides:
generateSemiparseAction
in classNodeTemplate
-
addRequiredAttribute
ATTENTION @param fieldname is a mangling result "attr_"+makeJavaName(). Currently called by TypedAttrsGenerator. -
addAttribute
ATTENTION @param fieldname is the original DTD name -
addAttributeInfo
-
setContentClass
-