- From: Asir S Vedamuthu <asirv@webmethods.com>
- Date: Tue, 2 Jul 2002 14:36:37 -0400
- To: "Roger L. Costello" <costello@mitre.org>, <xmlschema-dev@w3.org>
Let me attempt ..
First, notation decl
<xsd:notation name="ISO-1" public="-//ROGER//Costello1//EN"
system="http://www.iso.org/country-codes/version1" />
<xsd:notation name="ISO-2" public="-//ROGER//Costello2//EN"
system="http://www.iso.org/country-codes/version2" />
Second, a user-derived notation type
<xsd:simpleType name="myNOTATION">
<xsd:restriction base="xsd:NOTATION">
<xsd:enumeration value="ISO-1"/>
<xsd:enumeration value="ISO-2"/>
</xsd:restriction>
</xsd:simpleType>
Third, deploy myNOTATION
<xsd:element name="CountryCode">
<xsd:simpleContent>
<xsd:extension base="xsd:string>
<xsd:attribute name="vocabulary" type="myNOTATION"
default="ISO-1"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:element>
Caution: NOTATION in Schema is not equivalent to NOTATION in XML 1.0
Asir
-----Original Message-----
From: xmlschema-dev-request@w3.org
[mailto:xmlschema-dev-request@w3.org]On Behalf Of Roger L. Costello
Sent: Tuesday, July 02, 2002 2:06 PM
To: xmlschema-dev@w3.org; costello@mitre.org
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:31:32 UTC