@Runtime public class XantlrTdom extends Object
xantlr generated parser and a
tdom generated xml model.
The usage is documented with the methods
link
and parse()
and with the user
documentation of tdom.
| Modifier and Type | Field and Description |
|---|---|
protected static Class[] |
NOPARAMS |
protected static Class[] |
PARAM_SAXEVENTSTREAM |
| Constructor and Description |
|---|
XantlrTdom() |
| Modifier and Type | Method and Description |
|---|---|
protected <D> void |
init(X_LLkParser parser0,
MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> antlrMessages,
int queueSize,
ContentHandler debugSaxEvents,
TypedDTD tdomDtdModel,
MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> tdomMessages) |
static XantlrTdom |
link(X_LLkParser parser,
MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> antlrMessages,
int queueSize,
ContentHandler debugSaxEvents,
TypedDTD tdomDtdModel,
MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> tdomMessages)
This method creates a XantlrTdom object, which subsequently will be used
to parse a source text (with an xantlr generated parser,
see Xantlr user documentation.,
and to generate a corresponding tdom model,
see Tdom user documentation..
|
<D extends TypedDocument> |
parse(String parseFunctionName,
Class<D> documentClass) |
<D extends TypedDocument> |
parse(String parseFunctionName,
Class<D> documentClass,
String systemId)
This method initiates the parsing process, and supplies additional
arguments.
|
protected static final Class[] NOPARAMS
protected static final Class[] PARAM_SAXEVENTSTREAM
public static XantlrTdom link(X_LLkParser parser, MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> antlrMessages, int queueSize, ContentHandler debugSaxEvents, TypedDTD tdomDtdModel, MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> tdomMessages)
parser - an X_LLkParser which is already instantiated with the
lexer, and this lexer in turn with the source stream which shall be parsed later.
(So also a XantlrTdom is a use-once-throw-away kind of object!)antlrMessages - a mssage receiver into which the parsing errors generated
by the parser shall flow. (These errrors are quite frequent, because they
depend on the correctness of the user's (looser's) input !-)queueSize - regulates the size of the
SAXEventQueue which will be created
as a buffer.debugSaxEvents - is a second drain for sax events which can be used for
debugging. All SAX events generated by xantlr and fed to tdom will
be tee-ed to this drain.
(Please note: If you use a
ContentPrinter, then it will be useful
for debugging only if you plug it to a
PrintWriter_flushing, since the
implementation of streams on the varying platforms is full of surprises !-)tdomDtdModel - is the tdom.runtime.TypedDTD containing the parsing
method. This method will be found be reflection and activated in
a second thread, as described with the
parse() method.tdomMessages - is a msssage receiver into which the errors generated by
the tdom SAX receiver and validator are fed.protected <D> void init(X_LLkParser parser0, MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> antlrMessages, int queueSize, ContentHandler debugSaxEvents, TypedDTD tdomDtdModel, MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> tdomMessages)
public <D extends TypedDocument> D parse(String parseFunctionName, Class<D> documentClass, String systemId)
parseFunctionName - a String giving the name of that parse function
as generated by the antlr tool which corresponds to the start symbol
(nonterminal) of the parsing process. The method will be looked-up
and invoked using reflection.documentClass - is the tdom generated class which corresponds to
the document to generate.systemId - is the string which is used in the locators in all text
position related messages.public <D extends TypedDocument> D parse(String parseFunctionName, Class<D> documentClass)
see also the complete user documentation .