- From: Dr Mark H Phillips <mark@austrics.com.au>
- Date: Wed, 30 Nov 2005 18:15:37 +1030
- To: xmlschema-dev@w3.org
Hi, I have a simple schema that I wish to use for XML documents. I've been reading up on XML Schema, trying to find a way of expressing my schema using it, but so far have failed. I suspect it is currently not possible but thought I would ask on this list. Is it possible, and if not, is XML Schema likely to support it at some stage? Let me explain my schema. It has a root element called "root". Every element has precisely one attribute called "is", which must take one of three values: "atom", "hash" or "list". The root element must have is="hash", but all other elements can be any of the three, the default being "atom". An atom element must only have simple content. A hash element must have element content only, moreover it must not have more than one child element of the same name. A list element must have element content only, this being elements all called "item" (ie it will have 0 or more elements, all called "item"). Here is a simple example of a valid xml document: <?xml version="1.0" encoding="ISO-8859-1"?> <root is="hash"> <name>Laura Jones</name> <address is="hash"> <street>123 Trendy Avenue</street> <suburb>Prestigious Lakes</suburb> <postcode>4321</postcode> </address> <pets is="list"> <item>Ginger</item> <item>Polly</item> <item is="hash"> <name>Rover</name> <breed>Bulldog</breed> </item> </pets> <matrix is="list"> <item is="list"> <item>1</item><item>0</item><item>1</item> </item> <item is="list"> <item>0</item><item>1</item><item>0</item> </item> <item is="list"> <item>1</item><item>0</item><item>1</item> </item> </matrix> </root> What I'd like to do, is to define my schema as a "base schema" which doesn't say anything about the specifics of a particular structure, but only enforces the simple rules mentioned above. The idea would then be to take this base schema and add to it specific rules (for example about "name", "address", "pets" and "matrix") to form more tied-down schemas. Nothing I've read about XML-Schema seems to be appropriate for what I'm trying to achieve. Any help would be much appreciated! Mark Phillips.
Received on Wednesday, 30 November 2005 13:14:42 UTC