|
[EDI-L Mailing List Archive Home]
[Message List]
[Reply To This Message]
Re: Fw: PLEASE 'splain a DTD's purpose

> Out of the mouths of babes....
Out of the mouth of babes and sucklings hast thou ordained strength
because of thine enemies, that thou mightest still the enemy and the
avenger. Psalm 8:2, KJV
The lowly DTD is useful only for describing the skeletal structure of
the XML data. It is simply a catalogue of Elements available to use.
It shows the attributes they may contain. It also shows the
hierarchical arrangement of the element tree. Most of us know this.
It can say which elements/attributes are required and which ones are
optional. It can to some extent even describe the combinational rules
based solely on structure (not data).
It can say that an element is able to repeat, but cannot define an
upper limit on the number of occurrences.
It cannot say anything at all about the data content. It has no way
to put bounds on the min/max length of a string. It does have the
notion of a token list to allow only certain values in a field, but
in practice I have found that this tends to regress to amere #PCDATA
with allowable values described in comments.
Even if an element is mandatory, DTD validation only verifies that
the element is present, and doesn't give a hoot whether it contains
any data. Thus, if Name in BillTo is required, this
<BillTo>
<Name></Name>
</BillTo>
will satisify the DTD validation. For us, this
N1*BT~
will not.
Yes, I work for a company where it is my full-time job to translate
XML to and from EDI, for both X.12 and EDIFACT.
In practice, I have found that XML data is terribly unruly. I see
empty mandatory elements all the time. I see City names with only one
letter in test data.
I've see comment blocks where the entire purchase order, formatted
and structured has been pasted. Why, I could paste that block into a
text editor and print it, complete with field layout, headings,
underlines, and columns for the line items.
I've seen entire paragraphs for item descriptions that must go into
X.12's 80-char field, or worse, EDIFACT's pair of 35-char fields.
If the XML data supports named references, then you get into another
can of worms. Consider this:
<Reference name="Payment Terms">10 days, 5%, 30 day max</Reference>
And they want this turned into an ITD? or a PAT/PCD? Yeah, right.
How did you even know to anticipate the string "Payment Terms"? The
next customer sends "Pmt-Terms". And another "Terms of Payment". And
no two format the #PCDATA content the same way.
I had someone send this in a line item:
<Reference name="Buyer's part number">ABCDEFG</Reference>
They cried when I gave them this:
N9*ZZ*Buyer's part number~
MSG*ABCDEFG~
No, no, no. That's a comment. I can't map from that. Why can't you
just map it to the PO1 with product/service id BP? I wanted to see
this, PO1*...*BP*ABCDEFG~ That is the only way we can process it.
Some (or make that "most") people just don't get it.
All this rubbish satisfies the DTD validation honky-dory. And as long
as you're only doing rip 'n read, who cares? Let's just revert to
taking orders over the phone or fax, eh? That's electronic.
XML can be done right. Schemas do make a difference. But it still has
quite a way to go before its practice catches up with EDI.
Andrew
> ----- Original Message -----
> From: "xmEllen" <noemail@n...>
> Newsgroups: microsoft.public.xml
> Sent: Friday, November 01, 2002 2:03 PM
> Subject: PLEASE 'splain a DTD's purpose
>
>
> > Hi,
> >
> > I've been taking a class in XML where we have written DTD's and
> > Schemas as part of our coursework.
> >
> > The class material says that DTDs and Schemas are recommended to
> > ensure document conformity especially in Business-To-Business
> > transactions where XML documents are being exchanged.
> >
> > OK, so I work for Company A. I write an XML document and also
write a
> > DTD to go with it. I send my XML document and DTD to company B.
My
> > DTD says that my XML document must have element X which must have
> > exactly 3 specified child elements, and 2 specified attributes
and
> > so forth.
> >
> > While I am writing my XML document, I can use the DTD to validate
the
> > XML document to make sure that I've followed my own rules.
> >
> > But what's the point beyond insuring that I have followed my own
> > rules? When company B gets my XML file, what does it matter to
them
> > that I followed my own rules for how the XML document should be?
And
> > what if the DTD referenced in my xml doc somehow gets changed by
> > someone at Company B? Then what?
> >
> > IE has it's own DTD built inside which allows us to write and
look at
> > other people's html docs. But we cannot change this DTD - it is
built
> > into IE. We do have the ability to change and use any DTD we
want?
> > Wouldn't this spell confusion?
> >
> > I guess my question is what is the point of a DTD and Schema
beyond
> > insuring that xml writers follow their own rules.
> >
> > Thanks,
> > xmEllen
|
 |
Subscribe in XML format
| RSS 2.0 |
|
| Atom 0.3 |
|
|