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
FieldsModifier and TypeFieldDescriptionKeys are the original dtd name.(package private) MetaType(package private) DocumentTemplate(package private) final DTD.ElementThe 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 booleanDOCME(package private) static final MetaType(package private) static final MetaType(package private) final NamespaceName(package private) @Opt GeneratedConstructorSurvey on all GeneratedConstructor-s:(package private) @Opt GeneratedConstructorSurvey on all GeneratedConstructor-s:(package private) @Opt GeneratedConstructorSurvey on all GeneratedConstructor-s:contains the field names of formattr_[xxx].(package private) @Opt GeneratedConstructorSurvey on all GeneratedConstructor-s:(package private) @Opt GeneratedConstructorSurvey on all GeneratedConstructor-s:Accumulator for the generated semi-parser code.(package private) @Opt GeneratedConstructorSurvey on all GeneratedConstructor-s:(package private) final intDOCME(package private) final String(package private) GeneratedFieldField in the generated code of the element which holds the tag of the element, das defined in the DTD.(package private) @Opt GeneratedConstructorSurvey 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, visitMethodFields inherited from class eu.bandm.tools.tdom.NodeTemplate
actionMethod, decodeClosure, getDecodeClosure, getParseClosure, nodeClass, packageTemplate, parseClosure, parseSAX, parseSAXArguments, parseSAXAttributes, semiparseArguments, semiparseStatements, usingSemiparserFields inherited from class eu.bandm.tools.tdom.Template
formatClosure, msg -
Constructor Summary
ConstructorsConstructorDescriptionElementTemplate(PackageTemplate packageTemplate, DTD.Element element, NamespaceName nname, boolean isPublic) -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddAttribute(String fieldname, MetaClass cls) ATTENTION @param fieldname is the original DTD name(package private) voidaddAttributeInfo(MetaClass ainfo) (package private) voidaddRequiredAttribute(String fieldname) ATTENTION @param fieldname is a mangling result "attr_"+makeJavaName().(package private) voidvoidvoidfinish()Called from PackageTemplate.finish()protected voidCalled byContainerTemplate.finish().protected GeneratedMethodprotected GeneratedMethodprotected GeneratedMethodprotected voidprotected void(package private) voidprotected GeneratedConstructorThe "typed constructor" has the same signature as theset(...)method, namely what corresponds correctly to the content model (notwithstanding null-checks and array length.)protected GeneratedConstructorThe "untyped constructor" requires a tdom object and is NORMALLY NOT visible to/callable by the programmer.protected GeneratedMethodFor TypedSequence, TypedChoice, TypedAlt.(package private) booleangetName()protected Stringprotected voidvoidinit()voidinit2(TypedAttrsGenerator typedAttrsGenerator) Second part of initialization.booleanrestrictSafeFlags(boolean java, boolean saxDom) (package private) voidsetContentClass(MetaType contentClass) protected void(package private) voidsetIdAttribute(String idAttribute) Methods inherited from class eu.bandm.tools.tdom.ContainerTemplate
addAttrDescendStatement, addChild, addDecodeArgument, addDescendStatement, addDescendStatement, addVisitContentStatement, generateDecodeMethod, generateDecodeStatement, generateDumpElementsMethod, generateSetMethod, getNumber, internalSetDirectors, setNumbering, useSemiparserMethods 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_asFormatMethods inherited from class eu.bandm.tools.tdom.Template
error, error, expression, statement, statements, warning, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 <pkg>/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 <pkg>/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 <pkg>/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 <pkg>/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 <pkg>/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 <pkg>/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 <pkg>/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 byTypedAttrsGeneratorin "processOneAttDef" by invokingaddRequiredAttribute(String). -
allAttributes
Keys are the original dtd name. This info is only needed for documentation text generation. Has been filled byTypedAttrsGeneratorin "processOneAttDef" by invokingaddAttribute(String,MetaClass).
-
-
Constructor Details
-
ElementTemplate
public ElementTemplate(PackageTemplate packageTemplate, DTD.Element element, NamespaceName nname, boolean isPublic)
-
-
Method Details
-
contentModel
- Specified by:
contentModelin classContainerTemplate
-
getCaller
- Specified by:
getCallerin interfaceToplevelTemplate
-
get_allAttrsJavaSafe
boolean get_allAttrsJavaSafe() -
restrictSafeFlags
public boolean restrictSafeFlags(boolean java, boolean saxDom) - Specified by:
restrictSafeFlagsin interfaceToplevelTemplate
-
giveTypedConstructorSafe
protected void giveTypedConstructorSafe() -
init
public void init()- Overrides:
initin 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:
finishin classContainerTemplate
-
getToplevelClass
- Specified by:
getToplevelClassin interfaceToplevelTemplate
-
getName
- Specified by:
getNamein interfaceToplevelTemplate
-
getDocumentTemplate
- Specified by:
getDocumentTemplatein interfaceToplevelTemplate
-
addTagIndexField
void addTagIndexField() -
generateVisitMethod
Description copied from class:ContainerTemplateFor TypedSequence, TypedChoice, TypedAlt.- Overrides:
generateVisitMethodin classContainerTemplate
-
generateDumpMethod
- Overrides:
generateDumpMethodin classContainerTemplate
-
requiredAttributesText
-
generateTypedConstructor
Description copied from class:ContainerTemplateThe "typed constructor" has the same signature as theset(...)method, namely what corresponds correctly to the content model (notwithstanding null-checks and array length.)- Overrides:
generateTypedConstructorin classContainerTemplate
-
generateUntypedConstructor
Description copied from class:ContainerTemplateThe "untyped constructor" requires a tdom object and is NORMALLY NOT visible to/callable by the programmer.- Overrides:
generateUntypedConstructorin classContainerTemplate
-
generateParseMethod
- Overrides:
generateParseMethodin classContainerTemplate
-
generateDeclComment
protected void generateDeclComment()Called byContainerTemplate.finish().- Overrides:
generateDeclCommentin classContainerTemplate
-
getVisiteeName
- Overrides:
getVisiteeNamein classNodeTemplate
-
generateEncodeMethod
- Overrides:
generateEncodeMethodin classContainerTemplate
-
analyzeContent
public void analyzeContent() -
generateParseSAXAction
protected void generateParseSAXAction()- Overrides:
generateParseSAXActionin classNodeTemplate
-
setDirectors
- Specified by:
setDirectorsin classContainerTemplate
-
setIdAttribute
-
generateSemiparser_nonAlt
- Overrides:
generateSemiparser_nonAltin classNodeTemplate
-
generateSemiparseAction
protected void generateSemiparseAction()- Overrides:
generateSemiparseActionin 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
-