@User public class TypedDOMGenerator extends DTD.Visitor
perform()
write(int)
main(java.lang.String[])
procedure is only for bootstrapping purpose, use TDOM_Main
instead.)
metajava
"Generated[XXX]" instances.
The former keep information on a meta-level, needed for further code generation.
They are filled in different stages and possibly read information from other
template objects.
PackageTemplate
, which holds
esp. compiled information of the DTD (AttlistIndex etc) and the analysed command line
parameters, etc.
(The state machine and the data flow between these template objects is complicated, non-formalised and mostly still undocumented, FIXME !-)
Finally (2.2) "perform()" invokes the method "finish()" on the top template
(=packageTemplate
, propagating down).
The generated source text is written to output files by calling write(int)
.
Internally this is also propagated downwards through the template hierarchy by
invoking PackageTemplate.write(int)
.
Modifier and Type | Class and Description |
---|---|
static class |
TypedDOMGenerator.AbstractNamespaceCollector
Steps through the DTD and processes all PIs which have a tdom namespace declaration.
|
Modifier and Type | Field and Description |
---|---|
static GeneratedAnnotation |
annotationDeprecated |
static GeneratedAnnotation |
annotationOpt |
static GeneratedAnnotation |
annotationOverride |
static GeneratedAnnotation |
annotationUser |
static MetaClass |
checkedListPlusType |
static MetaClass |
checkedListType |
protected eu.bandm.tools.tdom.TypedDOMGenerator.DtdRenderer |
dtdRenderer
Stub which does nothing in the boot phase.
|
static MetaClass |
exception |
static Format |
FORMAT_DOC_SEPARATOR |
static MetaClass |
functionType |
protected boolean |
hasErrors
Sticky flag whether at least one error has been generated.
|
static int |
PUBLIC_STATIC_FINAL |
static String |
RENDERED_DTD_SUFFIX |
static String |
RUNTIME_PACKAGE_NAME
The qualified name of the package of the tdom runtime classes.
|
static MetaClass |
runtimeException |
static String |
STRING_DOC_SEPARATOR |
static MetaClass |
tdomAttributeException |
hasdescend, haspost, haspre
_visitor_debug_stream, partial
Constructor and Description |
---|
TypedDOMGenerator(DTD.Dtd dtd,
File destination,
String packageName,
boolean useArrays,
boolean generateFunctions,
boolean paisleySupport,
MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> rec)
Variant which gets the DTD as a completely self-contained object.
|
TypedDOMGenerator(File dtdFile,
FileReader dtdReader,
File destination,
String packageName,
boolean useArrays,
boolean generateFunctions,
boolean paisleySupport,
MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> rec)
Variant which reads the dtd from the given FileReader.
|
Modifier and Type | Method and Description |
---|---|
void |
action(DTD.Attlist attlist)
Does do nothing.
|
void |
action(DTD.Choice cp) |
void |
action(DTD.Dtd dtd)
Main activity of the TDOM compiler.
|
void |
action(DTD.Element element)
Code generation for one declared element.
|
void |
action(DTD.Empty content)
Do all compilation for an empty content model.
|
void |
action(DTD.Mixed content)
Generate all subclasses, constructors and parsing methods for mixed content.
|
void |
action(DTD.Seq cp) |
void |
action(DTD.Singleton cp)
Create the access methods for one single element reference in the
growing content model.
|
static String |
capitalize(String s)
Turn the very first character to uppercase.
|
protected void |
error(@Opt Exception ex,
@Opt Location<XMLDocumentIdentifier> location,
String text)
DOCME
|
protected void |
error(Location<XMLDocumentIdentifier> location,
String text)
DOCME
|
protected void |
error(String text)
DOCME
|
protected void |
exit()
DOCME
|
protected void |
fatalError(String text)
Send the error text to the message channel
msg and abort program execution
immediately. |
protected void |
log(String text)
DOCME
|
static void |
main(String[] args)
Deprecated.
use
TDOM_Main.main(String[]) instead, which has many more command
line options. |
protected static String |
makeFieldDescription(int number,
MetaClass contentClass)
make a human language identification of the compontent of a content model.
|
static String |
makeJavaName(String name)
Translate a token following the production [5] = Name or [7] = Nmtoken from
[XML 1.0]
into a Java identifier.
|
static @Opt String |
parsePI(DTD.PI pi,
String key)
Returns the tail of a PI's text, iff the target is "tdom", and the text
begins with key, followed by a blank or the end of the string.
|
void |
perform()
Main service access methods when using TDOM: Creates all components of the model.
|
protected static Format |
positionNumberFormat(int i) |
static void |
usage() |
protected void |
warning(String text)
DOCME
|
void |
write(int lineWidth)
Write out all components finally accumulated in
packageTemplate . |
action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, action, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, descend, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, post, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre, pre
action, action, action, action, 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, match, nomatch
public static final String RENDERED_DTD_SUFFIX
public static final GeneratedAnnotation annotationUser
public static final GeneratedAnnotation annotationDeprecated
public static final GeneratedAnnotation annotationOverride
public static final GeneratedAnnotation annotationOpt
public static final MetaClass functionType
public static final MetaClass checkedListType
public static final MetaClass checkedListPlusType
public static final MetaClass exception
public static final MetaClass runtimeException
public static final MetaClass tdomAttributeException
public static final int PUBLIC_STATIC_FINAL
@User public static final String RUNTIME_PACKAGE_NAME
eu.bandm.tools.tdom.runtime
".)protected boolean hasErrors
protected eu.bandm.tools.tdom.TypedDOMGenerator.DtdRenderer dtdRenderer
TDOM_Main
will override this function with an invocation of
HtmlRenderer
.public static final String STRING_DOC_SEPARATOR
public static final Format FORMAT_DOC_SEPARATOR
@User public TypedDOMGenerator(File dtdFile, FileReader dtdReader, File destination, String packageName, boolean useArrays, boolean generateFunctions, boolean paisleySupport, MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> rec)
packageTemplate
, which holds most global parameters, esp.
from the command line, and already extracts global information from the dtd.dtdFile
- the file containing the dtd.
(Needed to address the parent directory for DTD file includes.)dtdReader
- a reader delivering the dtd textdestination
- directory where to put the generared sourcespackageName
- the full java package name for all generated sourcesuseArrays
- whether to generate arrays instead of (checked) listsgenerateFunctions
- (deprecated due to jave "c::f" syntax, should be falsepaisleySupport
- whether to generated paisley patterns for field access FIXME NOT SUPPORTEDrec
- Receiver for all error messages@User public TypedDOMGenerator(DTD.Dtd dtd, File destination, String packageName, boolean useArrays, boolean generateFunctions, boolean paisleySupport, MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> rec)
packageTemplate
, which holds most global parameters, esp.
from the command line, and already extracts global information from the dtd.dtd
- the DTD object to translatedestination
- directory where to put the generated sourcespackageName
- the full java package name for all generated sourcesuseArrays
- whether to generate arrays instead of (checked) listsgenerateFunctions
- (deprecated due to jave "c::f" syntax, should be falsepaisleySupport
- whether to generated paisley patterns for field access FIXME NOT SUPPORTEDrec
- Receiver for all error messagespublic static void usage()
@User @Deprecated public static void main(String[] args)
TDOM_Main.main(String[])
instead, which has many more command
line options.@User public void perform()
packageTemplate
, which have been set up
when constructing this instance.
All generated instances are realized by subclasses of Template
and
can be retrieved from the packageTemplate
.
This method only executes a DTD visitor match() on the DTD object.@User public void write(int lineWidth)
packageTemplate
.
The text output goes to the destination which has been set when constructing this
and that instance.lineWidth
- the maximum column printed in the output (approx.!)protected void log(String text)
protected void warning(String text)
protected void error(Location<XMLDocumentIdentifier> location, String text)
protected void error(@Opt @Opt Exception ex, @Opt @Opt Location<XMLDocumentIdentifier> location, String text)
protected void error(String text)
protected void fatalError(String text)
msg
and abort program execution
immediately.protected void exit()
public void action(DTD.Dtd dtd)
TypedAttrsGenerator.prepareCommon(DTD.Dtd)
ElementTemplate
, mostly by descending
into the element's content model. Also methods from the
TypedAttrsGenerator.prepareCommon(DTD.Dtd)
are called for each
declared attribute.
action
in class DTD.Visitor
public void action(DTD.Element element)
action
in class DTD.Visitor
public void action(DTD.Attlist attlist)
action
in class DTD.Visitor
@User public static String makeJavaName(String name)
@User public static String capitalize(String s)
String.toUpperCase()
,
with default locale.public void action(DTD.Empty content)
action
in class DTD.Visitor
public void action(DTD.Mixed content)
action
in class DTD.Visitor
public void action(DTD.Singleton cp)
action
in class DTD.Visitor
public void action(DTD.Seq cp)
action
in class DTD.Visitor
public void action(DTD.Choice cp)
action
in class DTD.Visitor
@Opt public static @Opt String parsePI(DTD.PI pi, String key)
protected static Format positionNumberFormat(int i)
see also the complete user documentation .