- From: David Tombs <tombs@svrc.uq.edu.au>
- Date: Fri, 17 Jan 2003 17:28:43 +1000
- To: xmlschema-dev@w3.org
Hello All, How, in XML Schema, do I set up a datatype which is a single string representing a composition of more primitive strings, where the patterns and values allowed for the primitive strings are defined elsewhere? XMl Schema appears to offer a homogeneous composite type (ie all A or all B) (the list constructor, with limits on maxOccurs and minOcccurs) and a choice of either one A or one B (the union constructor), but not a heterogeneous composite type (one A and one B). My problem is I want to define a the content of a table where the table cells are formed from out of well-defined compositions of primitive elements separated by whitespace. In essence, I want to say something like <xsd:complexType name="TableRow"> <xsd:sequence> <xsd:element name="Column1" type="ClassA_string"/> <xsd:element name="Column2" type="ClassB_string"/> <xsd:element name="Column3" type="ClassAB_string"/> <xsd:element name="Column4" type="ClassABBB_string"/> </xsd:sequence> </xs:complexType> <xsd:simpleType name="ClassAB_string"> <xsd:restriction base="xsd:string"> <xsd:pattern value="{anything that matches ClassA_string}\s+{anything that matches ClassB_string}/> </xsd:restriction> </xsd:simpleType> <xsdsimpleType name="ClassABBB_string"> <xsd:restriction base="xsd:string"> <xsd:pattern value="{anything that matches ClassA_string}\s+({anything that matches ClassB_string}/s+)*/> </xsd:restriction> </xsd:simpleType> Here ClassA_string and ClassB_string are simple types, probably derived by pattern restriction, and defined by somebody else and liable to change. The braces in the examples are meant as an escape into the world of English, so that the first example means I want something that matches ClassA, followed by whitespace, followed by something that matches ClassB, while the second example is similar except the ClassB's may be iterated. Another example of the same problem is, to define a date_time type as a composition of a date value and a time value seprarated by a space character, and keep it consistent with all date values and time values lying around the system. Apologies if this is an old question, but I'm a newcomer to XML Schema. David -- ===================================== David Tombs Software Verification Research Centre University of Queensland Brisbane QLD 4072 phone +61 7 3365 1643 fax +61 7 3365 1533 email tombs@svrc.uq.edu.au =====================================
Received on Friday, 17 January 2003 06:16:49 UTC