Suman
Whatever you come up with needs to treat
dfdl:defineVariableBlock (or whatever we call it) the same as other 'global'
DFDL annotations like dfdl:defineTextNumberFormat and dfdl:defineTextCalendarFormat.
Currently those are only allowed at schema level. So are you
proposing that all these 'global' annotations can also live inside a dfdl:defineFormat
annotation?
You say best practice is to constrain
the variable block locally. Please can you state the reasons why this is.
Regards
Steve Hanson
Programming Model Architect
WebSphere Message Brokers
Hursley, UK
Internet: smh@uk.ibm.com
Phone (+44)/(0) 1962-815848
Suman Kalia/Toronto/IBM@IBMCA
16/06/2009 16:44
|
To
| Alan Powell/UK/IBM@IBMGB, Steve Hanson/UK/IBM@IBMGB
|
cc
| dfdl-wg@ogf.org, dfdl-wg-bounces@ogf.org
|
Subject
| Variable definitions in the defineFormat
block |
|
Alan/Steve - Changes after our
meeting this morning (June 16, 2009)
- Define a variable format block just
like we define textNumberFormat. The variable block could be at schema
level but preferably should be defined within the defineFormat definition
so that variables are scoped to format definition and do not pollute
the schema namespace..
- Variable block is referenced from dfdl:format
annotation just like textNumberFormat block is referenced through textNumberFormatRef
annotation.
It addresses the problem hilited
today in the meeting related to semantics of dfdl:ref="myFormat"
annotation on a xsd constructs. The net effect of this annotation is as
if the dfdl:format annotation (along with the attribute settings)
is specified explicitly on the xsd construct. By providing a level
of indirection and referencing variable block through varRef annotations,
we have permitted visibility to variables but not to the definition of
variables.
Excerpts from MyEnvelopeFormat.xsd
- attached for perusal.. Also attached is the [attachment "dfdl_variables_example_update.zip"
deleted by Steve Hanson/UK/IBM] PI for the example ( see updated
xsd files under the folder enveloper_skk)
<xsd:annotation>
<xsd:appinfo
source="http://dataformat.org/">
<dfdl:defineFormat
name="MyEnvelopeFormat"
baseFormat="dfdlDefaultFormat:defaultFormat"
>
<!--
statically override properties specific to the envelope wrapped messages
-->
<dfdl:format
byteOrder="big-Endian"
varRef="./MyEnvelopeFormatVariables"/>
<!--
Identify variables for processing the messages wrapped
in an envelope
i.e. the set of properties values that I need to
take from input data and
dynamically set the values of dfdl properties
during the processing of the message.
Assumption: Names of variables defined in the format
are unique
-->
<!-- Define the variables needed for the format locally in the
format block -->
<!--
They could also be defined at the schema level and referenced through
varRef -->
<!--
as its definition is QName just like textFormatBlock or numberFormatBlock
-->
<!--
Best practice would be to constraint the variable block locally
-->
<dfdl:defineVariableBlock
name="MyEnvelopeFormatVariables">
<dfdl:defineVariable
name="sep"
type="string"
/>
<dfdl:defineVariable
name="enc"
type="string"
/>
<dfdl:defineVariable
name="outputDirPathSep"
type="string"
default="/"
use="output"
/>
<dfdl:defineVariable
name="outputMsgKind"
type="string"
use="output"
/>
<dfdl:defineVariable
name="inputMsgKind"
type="string"
use="input"
/>
</dfdl:defineVariableBlock>
</dfdl:defineFormat>
</xsd:appinfo>
</xsd:annotation>
Suman Kalia
IBM Toronto Lab
WMB Toolkit Architect and Development Lead
WebSphere Business Integration Application Connectivity Tools
http://www.ibm.com/developerworks/websphere/zones/businessintegration/wmb.html
Tel : 905-413-3923 T/L 969-3923
Fax : 905-413-4850 T/L 969-4850
Internet ID : kalia@ca.ibm.com
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU