Eric van der Vlist wrote:
> Looks like we are going towards 4 different types of XML "schema" > languages to define: > > - The structure > - The datatypes > - The rules > - The semantic. You made an excellent point.
Let me use a project I am working on to illustrate this division. Although SWIFT has a plan to adopt XML, the legacy SWIFT
format is expected
to coexist with whatever new standard under construction. We
are undertaking
a project that maps traditional SWIFT standard directly to
some "interim"
XML format.
Structure
DTD is sufficient to express the structure:
<!ELEMENT message (header1, header2, header3?, body,
trailer?)>
<!ELEMENT body (field*)> <!ELEMENT field (fieldline*|subfield*)>
<!ATTLIST field tag NMTOKEN #REQUIRED>
...
XSL transformation rules are based on processing on these
structural elements
too.
The Datatypes
When it gets to datatypes, then schema definitions have to be
used for the
granularity.
Rules
In plain English, a SWIFT message rule is expressed as
something like:
"If the value of field 17U is 'Y', then field 15D must
exist."
I write it in XML Schema form:
<complextype name='F17URule'>
<any maxOccurs='*'/>
<body>
<any maxOccurs='*'/> <element name='FIELD' tag='17U'> <complextype> <element name='FIELDLINE' fixed='Y'/> </complextype>
</element> <any maxOccurs='*'/> <element name='BLOCK'> <complextype> <element name='FIELD' tag='15D'/> <any maxOccurs='*'/>
</complextype>
</element> <any maxOccurs='*'/>
</body>
</complextype> We relax the schema to allow multiple types to apply the
rules. This way, we
can limit ourselves to only XML Schema standard. A
preprocessor can process this
into an enormous standard schema by using union. I am a
compiler guy, so I
prefer writing my rules in grammar approach and apply
preprocessing for
standard compliance.
Can anyone show this rule in other forms? Please criticize my
approach.
Semantics
The definition of semantics can start a philosophical
discussion. However,
we are computer people, so we only need semantics useful for
computer
processing.
Definition: Semantics. All the basic relationships involving
an object, that
are sufficient to deduct all the relationships required for
computing tasks
about this object.
In our specific case, a SWIFT message is used to relate to
other SWIFT
messages of the same or different types. A collection of the
match, amendment,
cancellation, and field correlation rules among SWIFT messages
make up
the semantics of the SWIFT messages.
Jay Zhang
IntermicsTech, Inc.
|