- From: Dan Connolly <connolly@w3.org>
- Date: Tue, 05 Sep 2000 10:56:27 -0500
- To: Neil Archer <neil.archer@viewgate.com>
- CC: "XML Schema List (E-mail)" <xmlschema-dev@w3.org>
Neil Archer wrote: > > Hi, > > I have been trying to convert some DTD's we are using to the equivalent XML > schema, but I cannot find a way to reflect the DTD OR which states that one > or the other element only can be specified. > > i.e. if a document could contain an element A or an element B but not both > the DTD would state something like: > > <!ELEMENT document((A|B))> > > Can anyone help by suggesting how I can show this in an XML schema? Some folks around here have developed a tool that does just that. From the documentation: [[[ <!ELEMENT ROOT (A|B) > <element name="ROOT"> <complexType content="elementOnly"> <choice> <element ref="t:A"> <element ref="t:B"> </choice> </complexType> <element> ]]] -- http://www.w3.org/2000/04/schema_hack/ > Please > forgive me if there is an obvious answer to this but I'm new to using > schemas and cant see a simple solution. I think the answer is fairly straightforward, but your experience shows that it is not obvious. May I ask which of the specs you have managed to read? Have you seen the primer? http://www.w3.org/TR/xmlschema-0/ Did you use other materials besides the specs to learn about XML Schemas? e.g. The XML Schema Specification in Context by Rick Jelliffe, Academia Sinica Computing Centre 2000-02-24 draft only compares XML Schema with XML DTDs, SGML DTDs, HyTime, and perl regular expressions http://www.ascc.net/~ricko/XMLSchemaInContext.html Both the DTD->schema tool and the "in Context" discussion document are linked from our page about XML Schema: http://www.w3.org/XML/Schema -- Dan Connolly, W3C http://www.w3.org/People/Connolly/
Received on Tuesday, 5 September 2000 11:57:21 UTC