Subject: [Ltru] DOCTYPE ltru

From: Frank Ellermann <[email-masked]>
Date: Sat, 16 Sep 2006 00:54:31 +0200

For the XML fans, below you find a possible DTD for the
ltru2xml script posted yesterday.  I've never tried that
before, probably it's clumsy.  The W3C validator accepts
it for a converted registry.

Frank

<?xml version="1.0" encoding="US-ASCII" standalone='yes' ?>

<!DOCTYPE ltru [
<!ELEMENT ltru (language*, extlang*, script*, region*, variant*,
grandfathered*, redundant*)>
<!ATTLIST ltru
        date NMTOKEN #REQUIRED

<!ELEMENT language (suppress?, deprecated?, description+, comment*)>
<!ATTLIST language
        date NMTOKEN #REQUIRED
        tag  NMTOKEN #REQUIRED

<!ELEMENT extlang (prefix, deprecated?, description+, comment*)>
<!ATTLIST extlang
        date NMTOKEN #REQUIRED
        tag  NMTOKEN #REQUIRED

<!ELEMENT script (deprecated?, description+, comment*)>
<!ATTLIST script
        date NMTOKEN #REQUIRED
        tag  NMTOKEN #REQUIRED

<!ELEMENT region (deprecated?, description+, comment*)>
<!ATTLIST region
        date NMTOKEN #REQUIRED
        tag  NMTOKEN #REQUIRED

<!ELEMENT variant (prefix*, deprecated?, description+, comment*)>
<!ATTLIST variant
        date NMTOKEN #REQUIRED
        tag  NMTOKEN #REQUIRED

<!ELEMENT grandfathered (deprecated?, description+, comment*)>
<!ATTLIST grandfathered
        date NMTOKEN #REQUIRED
        tag  NMTOKEN #REQUIRED

<!ELEMENT redundant (deprecated?, description+, comment*)>
<!ATTLIST redundant
        date NMTOKEN #REQUIRED
        tag  NMTOKEN #REQUIRED

<!ELEMENT suppress EMPTY>
<!ATTLIST suppress
        tag  NMTOKEN #REQUIRED

<!ELEMENT prefix EMPTY>
<!ATTLIST prefix
        tag  NMTOKEN #REQUIRED

<!ELEMENT deprecated EMPTY>
<!ATTLIST deprecated
        date NMTOKEN #REQUIRED
        tag  NMTOKEN #IMPLIED

<!ELEMENT description (#PCDATA)>
<!ELEMENT comment (#PCDATA)>
]>

<ltru date='2006-08-04'>
<language date='2005-10-16' tag='aa'>
        <description> Afar </description>
</language>
<!-- etc. --></ltru>

_______________________________________________
Ltru mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/ltru

---

From: Frank Ellermann <[email-masked]>
Date: Sat, 16 Sep 2006 10:04:22 +0200

> For the XML fans, below you find a possible DTD

Now I tried to add the XREF feature from my REXX registry
validator to the DTD (see below).  That resulted in three
special cases:

zh-cmn  We have no extlang cmn at the moment, therefore I
got a missing ID _cmn.  Problem disabled by special hack.

zh-hakka  Similar, but there will be no _hakka variant,
the "missing" ID _hakka has to be permanently disabled.

The grandfathered zh-cmn and zh-hakka of course exist,
but my parser tries to decompose such tags into IDREFS.

The third problem is apparently a bug in the registry:
missing ID _latn (small L) in yi-latn.  For the REXX
validator I never saw that because it internally works
case-insensitive, but with XML ID _latn is not _Latn.

Frank

<?xml version="1.0" encoding="US-ASCII" standalone='yes' ?>
<!DOCTYPE ltru [
<!ELEMENT ltru (language*, extlang*, script*, region*, variant*, grandfathered*, redundant*)>
<!ATTLIST ltru
        date NMTOKEN #REQUIRED
        xml:id ID    #REQUIRED
        xml:id ID    #REQUIRED
        xml:id ID    #REQUIRED
        xml:id ID    #REQUIRED
        xml:id ID    #REQUIRED
        ref  IDREFS  #REQUIRED
        ref  IDREF   #REQUIRED
<!ELEMENT prefix EMPTY>
<!ATTLIST prefix
        tag  NMTOKEN #REQUIRED
        ref  IDREFS  #REQUIRED
        ref  IDREFS  #IMPLIED

<ltru date='2006-08-04'>
<language date='2005-10-16' tag='aa' xml:id='_aa'>
        <description> Afar </description>
</language>
<!-- etc. -->
<redundant date='2005-04-11' tag='zh-Hant-TW' ref='_zh _Hant _TW'>
        <description> Taiwan Chinese in traditional script </description>
</redundant>
</ltru>

---

From: Stephane Bortzmeyer <[email-masked]>
Date: Sun, 17 Sep 2006 16:34:45 +0200

On Sat, Sep 16, 2006 at 12:54:31AM +0200,
 Frank Ellermann <[email-masked]> wrote 

> it for a converted registry.

A few remarks (only on details, I won't get in the dispute
elements-vs-attributes):

1) May be we should use the same vocabulary as the RFC 4646. For
instance, you use "date" when the RFC uses (except for the <ltru>
element) "added". Or you use "tag" when the RFC uses subtag or tag,
depending on the type.

2) Even with DTDs, I believe it is possible to factor common terms
like "description", which is the same for every record.

3) I do not see Preferred-value in your schema?

I attached my own attempt, written in RelaxNG, and a translated
registry.

---

From: Frank Ellermann <[email-masked]>
Date: Sun, 17 Sep 2006 17:43:26 +0200

Stephane Bortzmeyer wrote:
 
> May be we should use the same vocabulary as the RFC 4646. For
> instance, you use "date" when the RFC uses (except for the
> <ltru> element) "added".

Yes, I wanted the same attribute name for all dates.  With a
DTD some ABNF details are lost, I've used the name for a hint
about the real type (NMTOKEN isn't very precise for dates ;-)

> Or you use "tag" when the RFC uses subtag or tag,

Same idea.  In the version supporting ID-XREF-checks I could
keep "subtag" as is, and use "tag" only as attribute for the
grandfathered, redundant, prefix, and deprecated elements.

> I do not see Preferred-value in your schema?

It's the optional (#IMPLIED) "tag" in a <deprecated> element.

If I'd split "tag" vs. "subtag" a "tag" is syntactically the
same as "xml:lang", but of course I can't abuse that as name.

Your RELAXed spec. is Greek to me.  That's no problem, but it
also won't work as is with a DTD validator.  With my version
I'm sure that only descriptions and comments are "text", the
rest is either a "date" or a "tag" (modulo "subtag").

Frank

---

From: Stephane Bortzmeyer <[email-masked]>
Date: Sun, 17 Sep 2006 19:12:07 +0200

On Sun, Sep 17, 2006 at 05:43:26PM +0200,
 Frank Ellermann <[email-masked]> wrote 
 a message of 36 lines which said:

> With a DTD some ABNF details are lost, I've used the name for a hint

Yes, one more reason to drop DTD (it is the only XML schema language
without typing).

> It's the optional (#IMPLIED) "tag" in a <deprecated> element.

OK, sorry for missing it.
 
> Your RELAXed spec. is Greek to me. 

Well, if you know DTD and not RelaxNG, I'm not surprised. But people,
specially software people, who have no prior experience with either
DTD or RelaxNG, often find that RelaxNG is more readable.

Anyway, it is probably not a good idea to start a lengthy discussion
about the various schema languages for XML (specially since we can
have several: some W3C standards work that way, and RFC 2629 has an
unofficial RelaxNG schema, as well as the old and official DTD).

> That's no problem, but it also won't work as is with a DTD
> validator.

Of course. And your DTD will not work with a RelaxNG validator
either. What's the point? To prove that a Perl script will not run
with a Python compiler? :-)

---

From: Martin Duerst <[email-masked]>
Date: Mon, 18 Sep 2006 11:21:51 +0900

>about the real type (NMTOKEN isn't very precise for dates ;-)

That's not the way XML is supposed to work. The names are
supposed to say what something is, not to indicate the type.
In a DTD, additional type information should go into
comments. If you want to express/check these, use XML Schema
or Relax or Schematron or a script.

>It's the optional (#IMPLIED) "tag" in a <deprecated> element.

If it's the preferred value, call it that. The idea of XML
is that people understand as much as possible from the data
and markup itself.

Regards,    Martin.

#-#-#  Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University
#-#-#  http://www.sw.it.aoyama.ac.jp       mailto:[email-masked]