|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.reverseXSL.parser.Definition
public final class Definition
A Definition object holds the complete hierarchical description of a text-based
structured message. In other words, it contains all instructions for the correct
interpretation of an input message by the Parser
.
The Definition class models the object in memory whereas a DEF file is the same object represented in a sequential text file.
The DEF file contains a optional SET BASENAMESPACE statement, followed by a 'Named Conditions' block, followed by the larger 'MSG...END' block that describes the hierarchical message structure.
A DEF file has the following general layout:
SET BASENAMESPACE ... optional specification of the root element namespace
Please refer to the MS-Word documentation 'Message DEF file specs.doc' for a complete description of the
Definition objects and file syntax.
COND ... specification of interdependency rules (conditions)
COND ...
... more COND lines
Comments may be written elsewhere; by convention, these are lines starting
with a space or tab character.
MSG The top level segment is the message itself and is level 0 by definition
The top level segment is noted MSG instead of SEG, although it is a SEGment
The '|' characters are actually part of the syntax of the DEF file itself.
|SEG first segment at level 1 with a single data piece
||D data and other segments here are at level 2, hence prefixed ||
|SEG second segment with 4 data pieces
||D first data element
||D second data element
||SEG the third data element is a "sub-segment", i.e. a composite
|||D first sub-element
|||D second sub-element
||D fourth data element, back to level 2
|SEG third segment within the top-level segment, i.e. at level 1
||D
||D
|GRP first group at level 1, a group is only a logical grouping of segments or
other groups that are then, by principle, at the next level
||SEG a segment at level 2, first within the group
|||D
|||D
|MARK evaluates a condition on the fly and marks it at this point in the message
||GRP a sub-group at level 2 within the level 1 group
|||D Data elements may be placed directly in groups as well
|||SEG a segment at level 3 within the previous level 2 group
||||SEG a sub-segment, then at level 4
|||| etc. the rest of level 4 shall contain data and sub-segments,
and sub-segments may again contain segments and groups!
|||SEG
||SEG back to level 2, hence next to the previous group
||GRP ...more groups, etc.
END marks the end of the message definition
Constructor Summary | |
---|---|
Definition()
This is the only way to create a new Definition object. |
Method Summary | |
---|---|
java.io.StringWriter |
getXMLSample(boolean indent,
boolean withSKIP)
Generates a sample XML message with element descriptions as data values. |
void |
loadDefinition(java.io.LineNumberReader inputDEF)
Build a Definition object from a LineNumberReader containing
a complete DEF file. |
java.lang.String |
toString()
In order to trace the definition itself, i.e. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Definition()
It shall then be loaded with a definition
using loadDefinition(LineNumberReader)
.
Once loaded, pass it as argument to a Parser constructor.
Method Detail |
---|
public java.io.StringWriter getXMLSample(boolean indent, boolean withSKIP) throws javax.xml.transform.TransformerFactoryConfigurationError, javax.xml.transform.TransformerException, javax.xml.parsers.ParserConfigurationException
The current implementation generates only one instance of each element.
indent
- whether we ask to indent the XML documentwithSKIP
- whether we ask to generate XML elements with SKIP tags
javax.xml.transform.TransformerFactoryConfigurationError
javax.xml.transform.TransformerException
javax.xml.parsers.ParserConfigurationException
public void loadDefinition(java.io.LineNumberReader inputDEF) throws java.io.IOException, ParserException
LineNumberReader
containing
a complete DEF file.
Definition objects contain pure 'read-only' definitions and thus can be shared by as many threads as desired.
inputDEF
- line number reader containing a complete DEF file
java.io.IOException
ParserException
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |