W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2000

LC-136: symbolic constants

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Wed, 21 Jun 2000 12:52:54 -0600
Message-ID: <B2C1451A181BD411B88A00E018C1C19C08A683@THOR>
To: "'Steven.Goldfarb@cern.ch'" <Steven.Goldfarb@cern.ch>, "'olken@lbl.gov'" <olken@lbl.gov>, "'marting@develop.com'" <marting@develop.com>
Cc: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Re: http://www.w3.org/2000/05/12-xmlschema-lcissues.xml#constants

I think the actual resolution of the symbolic constants is outside what you could expect from a generic XML processor, however a resolution of LC-2 conjunction types
(http://www.w3.org/2000/05/12-xmlschema-lcissues.xml#conjunction-types) and/or open enumerations (http://lists.w3.org/Archives/Public/www-xml-schema-comments/1999OctDec/0022.html and
http://lists.w3.org/Archives/Public/www-xml-schema-comments/1999OctDec/0023.html)  might enable the behavior that you desire.

For example, using conjunction types:

<xsd:schema ...>
	<xsd:simpleType name="length" base="double">
		<xsd:annotation>
			<xsd:documentation>Length in meters</xsd:documentation>
		</xsd:annotation>
	</xsd:simpleType>
	<xsd:simpleType name="expression" base="string">
		<xsd:pattern value="$.*"/>
	</xsd:simpleType>
	<xsd:simpleType name="lengthExpr" base="string">
		<xsd:or>
			<xsd:conform type="myschema:length"/>
			<xsd:comform base="myschema:expression"/>
		</xsd:or>
	</xsd:simpleType>

	<xsd:element name="box">
		<xsd:complexType>
			<xsd:attribute name="X" type="myschema:lengthExpr"/>
		</xsd:compleType>
		...
	</xsd:element>
	...
</xsd:schema>

This would allow the X attribute of box to be either a double interpreted as length in meters or a string starting with a $ that would be interpreted as an expression that would have to be resolved by
the application.

Open enumerations (which is referenced in LC-191 and I think is worthy of its own issue number with or without the substitution feature mentioned here) would allow you to have the equivalent of schema
defined symbolic constants.  Not quite what you example was doing, but similar.   For example:

<xsd:schema ...>
	<xsd:simpleType name="length" base="double">
		<xsd:enumeration open="true">
			<xsd:literal value="1000">1Km</xsd:literal>
		</xsd:enumeration>
	</xsd:simpleType>
...
</xsd:schema>

This would allow the length datatype to accept any legal double and in addition if the value matched any listed literal, the value would be substituted.
Received on Wednesday, 21 June 2000 15:06:30 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:52 UTC