- From: Roger L. Costello <costello@mitre.org>
- Date: Tue, 02 Jul 2002 14:05:55 -0400
- To: xmlschema-dev@w3.org, costello@mitre.org
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:08:23 UTC