schemas and variables example (envelop & payloads)
I enclosed an eclipse project. If you import this to eclipse (ganymede version) it does a pretty good job at validating and helping you work with DFDL. The 'variables' subdir contains an example of using variables to bind parameters for contained "payloads" of an enclosing envelope. The example is that the payloads are either absolute or relative path names, but the separator is specified by the envelope along with the character set. So, for example: the contents could be C:\a\b\c or C:/a/b/c or d\e\f or d/e/f. I'm curious as to what people think of this example. It's pretty short. Note: Please do not send sensitive data in unencrypted form in email. We cannot provide secure transit for email over the Internet. Mike Beckerle | CTO | Oco, Inc Tel: 781-810-2125 | 100 Fifth Ave, 4th Floor, Waltham, MA 02451 | mbeckerle@oco-inc.com | www.oco-inc.com http://www.oco-inc.com/ Blog: cboblog.typepad.com http://cboblog.typepad.com/ TURNING DATA INTO ANSWERS. FASTER THAN YOU EVER IMAGINED.
Mike
Some comments on your example (note I used the updated .zip in your other
mail).
- The number of variables make it harder than it needs to be to understand
- see later comments.
- I think it would have been clearer if the setting of 'sep' and
'msgKind' was symmetric, I would set the two 'sep' variables on the
'dirPathSep' element.
- The encoding could be constant to makes things simpler.
- It would have helped if you had defined 'msgKindType' simple type with
enums 'A' and 'R', and a 'dirPathSep' simple type with enums '/' and '\'.
- For this example, it would be clearer if 'dirPathSep' and 'msgKind' were
not set via outputValueCalc and their values were just provided by the
infoset. Given that they are not hidden this makes more sense. If you want
to set them using outputValueCalc then I would suggest that you make the
entire header hidden.
- I'm not sure that the modelling of the paths works. The file name will
be consumed by the pathPart element, because the delimiters are
prefix/infix. I think you need to use postfix separators or terminators.
With postfix separator, failure to find the separator when matching the
last part to 'pathPart' will cause a backtrack, and we will then try and
(correctly) match the last part to 'file'. Note that there is just one
sequence when you do it this way, as the separator also applies to
'driveLetter'.
<element name="absolutePath">
<complexType dfdl:representation="text" dfdl:encoding="{$enc}"
dfdl:lengthKind="delimited">
<sequence
dfdl:separator="{$sep}"
dfdl:separatorPosition="postfix">
<element name="driveLetter" type="string"
dfdl:length="1"
dfdl:lengthKind="explicit"
dfdl:terminator=":"/>
<element name="pathPart" type="string" maxOccurs
="30" minOccurs="0" />
<element name="file" type="string"
dfdl:lengthKind="endOfParent"/>
</sequence>
</complexType>
</element>
If it can be simplified then I like it as an example to show both payload
resolution and dynamic markup, and I'd like to build on it for action 028
(watch this space).
Regards
Steve Hanson
Programming Model Architect
WebSphere Message Brokers
Hursley, UK
Internet: smh@uk.ibm.com
Phone (+44)/(0) 1962-815848
"Mike Beckerle"
participants (2)
-
Mike Beckerle
-
Steve Hanson