- From: Dare Obasanjo <dareo@microsoft.com>
- Date: Tue, 2 Jul 2002 11:19:36 -0700
- To: "Roger L. Costello" <costello@mitre.org>, <xmlschema-dev@w3.org>, <costello@mitre.org>
One of our XML Schema WG reps opined that notations in W3C XML Schema are not the same as those from DTDs in XML 1.0 due to various incompatibilities that couldn't be resolved.
-----Original Message-----
From: Roger L. Costello [mailto:costello@mitre.org]
Sent: Tue 7/2/2002 11:05 AM
To: xmlschema-dev@w3.org; costello@mitre.org
Cc:
Subject: Representing NOTATIONs in XML Schema?
Hi Folks,
I am trying to convert a DTD which uses NOTATIONs into an XML Schema. I
never use NOTATIONs so I am not sure what the XML Schema should look
like.
[Separate question: does anyone use NOTATIONs in XML? I thought that
NOTATIONs was an SGML thing that had lost favor in the XML community. I
would be very interested in knowing the answer to this question.]
Let's take an example. Here's a DTD snippet which declares an element
and a NOTATION attribute:
<!ELEMENT CountryCode (#PCDATA)>
<!ATTLIST CountryCode
vocabulary NOTATION (ISO-1 | ISO-2) "ISO-1">
<!NOTATION ISO-1 SYSTEM "http://www.iso.org/country-codes/version1">
<!NOTATION ISO-2 SYSTEM "http://www.iso.org/country-codes/version2">
What would the corresponding XML Schema look like? Here's my take on
it:
<xsd:element name="CountryCode">
<xsd:simpleContent>
<xsd:extension base="xsd:string>
<xsd:attribute name="vocabulary" type="ISO-1_NOTATION"/>
<xsd:attribute name="vocabulary" type="ISO-2_NOTATION"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:element>
<xsd:simpleType name="ISO-1_NOTATION">
<xsd:restriction base="xsd:NOTATION">
<xsd:enumeration
value="http://www.iso.org/country-codes/version1"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ISO-2_NOTATION">
<xsd:restriction base="xsd:NOTATION">
<xsd:enumeration
value="http://www.iso.org/country-codes/version2"/>
</xsd:restriction>
</xsd:simpleType>
Some things to note:
1. I know that this XML Schema is incorrect. The datatypes spec says
that the value of a NOTATION must be a QNAME. I am not giving the
enumeration facet a QNAME.
2. The datatype's spec also says that it is invalid to use the NOTATION
datatype directly. Rather, you must use a derived type. That's why I
created the simpleType definitions.
3. The bottom line is: I really don't know how to represent NOTATIONs in
XML Schemas. Any help would be appreciated. /Roger
Received on Tuesday, 2 July 2002 14:20:18 UTC