Package eu.bandm.tools.d2d2.base
Class Dtd2Def.Phase1
java.lang.Object
eu.bandm.tools.dtm.DTM.MATCH_ONLY_00
eu.bandm.tools.dtm.DTM.SinglePathVisitor
eu.bandm.tools.d2d2.base.Dtd2Def.Phase1
- Enclosing class:
- Dtd2Def
Main translation phase which visits all DTD element definitions and
generates their d2d tag expression according to their dtd content model
and attribute list.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Translates d2d attribute definitions to d2d expressions on references. -
Field Summary
Modifier and TypeFieldDescription(package private) Location<XMLDocumentIdentifier>
Location of the currently visited element.protected Expression
Visitor result register of the last generated expression.Fields inherited from class eu.bandm.tools.dtm.DTM.MATCH_ONLY_00
_visitor_debug_stream, partial
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
action
(DTM.Choice x) Translate an alternative of DTD contents into an alternative of d2d expressions.protected void
action
(DTM.Element el) Generate the d2d definition element and its contents expressions.protected void
Translate a "mixed" dtd content model into a d2d "starred alternative" expression.protected void
Translate a sequence of DTD contents into a sequence of d2d expressions.protected void
Translate a singleton content particle into the d2d singleton reference.protected @Opt Definition
globalDefForAtt
(String name, DTM.Attribute attdef) Construct a common d2d tag element definition for a given attribute.protected Definition
makeAttribute
(SourceItem context, String name, DTM.Attribute att) Create a new d2d-definition for a dtd attribute value.protected Expression
makeRef
(DTM.ElementRef eref) Make a d2d reference for a dtm reference.protected void
Apply the dtd-level modifier to the current expression.Methods inherited from class eu.bandm.tools.dtm.DTM.SinglePathVisitor
action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, follow_alts, follow_attrs, follow_elems, follow_elems, follow_elems, follow_instructions
Methods inherited from class eu.bandm.tools.dtm.DTM.MATCH_ONLY_00
action, action, action, compile, followAll_alts, followAll_attrs, followAll_elems, followAll_elems, followAll_elems, followAll_instructions, foreignObject, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, match, nomatch
-
Field Details
-
elloc
Location<XMLDocumentIdentifier> ellocLocation of the currently visited element. DTD expressions do not have their own location value in the current umod. Therefore se the one on "<!ELEMENT..
" level for error messages. -
expr
Visitor result register of the last generated expression.
-
-
Constructor Details
-
Phase1
protected Phase1()
-
-
Method Details
-
action
Generate the d2d definition element and its contents expressions.- Overrides:
action
in classDTM.SinglePathVisitor
-
makeRef
Make a d2d reference for a dtm reference. Enter only the name and the original source text location. The definition is not yet entered = the reference stays "unresolved". -
modify
Apply the dtd-level modifier to the current expression. -
action
Translate a singleton content particle into the d2d singleton reference.- Overrides:
action
in classDTM.SinglePathVisitor
-
action
Translate a sequence of DTD contents into a sequence of d2d expressions.- Overrides:
action
in classDTM.SinglePathVisitor
-
action
Translate an alternative of DTD contents into an alternative of d2d expressions.- Overrides:
action
in classDTM.SinglePathVisitor
-
action
Translate a "mixed" dtd content model into a d2d "starred alternative" expression.- Overrides:
action
in classDTM.SinglePathVisitor
-
makeAttribute
Create a new d2d-definition for a dtd attribute value. Give it "trimmed" storage type.- Parameters:
context
- either the global att dummy element container, or an element d2d definitionname
- the name of the new d2d definition, possibly mangled, because it must work LL(1)-disambuig as an input tag.att
- the original dtd definition; defines the xml output tag and the location.
-
globalDefForAtt
Construct a common d2d tag element definition for a given attribute. Note that currently dtd-attribute "types" are not analyzed. there is only the type "text". Therefore all attributes with the same name and generating the same xml-tag (= not accidentally the same name due to mangling), and wich are not fixed (fixed attributes are not translated at all, anyhow), are equivalent and can be mapped to ONE(1) global d2d XRegExp.- Parameters:
name
- the name of the new d2d definition. It is the original local name plus possibly some prefix for dis-ambiguation!- Returns:
- the new definition, or null iff name already in use for a different xml tag. Then the caller can decide to realize the att as a LOCAL definition (or re-try after mangling).
-