1. The elements are all strings, and they do not have fixed lengths, set values, or any other terminator. The only way you know them apart is by the initiator. (And this implies that the initiators cannot be part of the elements.)
2. There are no separators (spaces can be in the data).
3.
The third and
fourth elements are optional.
So these are both valid data:
FirstName John Mark LastName
Smith
FirstName Bob LastName Brown
Company IBM
How do we model this?
Attempt #1:
I have four elements each with
a unique initiator (FirstName, LastName, Hometown, Company). The
problem is that there’s no way to know when the first element terminates,
so everything after the “FirstName” initiator ends up in the FirstName
element. Oops.
Attempt #2:
I got funky with the terminators.
The first element has LastName as a terminator. The second
element has Hometown or Company as an element. The third element
has Company or %NL; as an element. And the fourth one uses %NL;.
Works great, unless the optional third element isn’t there. IOW,
if I have this input:
FirstName Bob LastName Brown
Company IBM
Then “IBM” winds up in Hometown
element. Oops.
So, what to do? I don’t
know. I don’t know how to solve this. Hopefully you’re going
to teach me about some feature I don’t yet know.
If not, then I have a potential
solution, an addition to the spec. Add this option as a terminator:
“This element terminates when you find the initiator to the next
element.” That’s probably easier said than done, but it seems to
make sense in this context.
--
dfdl-wg mailing list
dfdl-wg@ogf.org
https://www.ogf.org/mailman/listinfo/dfdl-wg
--
Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | www.tresys.com--
dfdl-wg mailing list
dfdl-wg@ogf.org
https://www.ogf.org/mailman/listinfo/dfdl-wg
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