- From: George Cristian Bina <george@sync.ro>
- Date: Thu, 05 Aug 2004 17:35:40 +0300
- To: Ciprian Ciubotariu <cheepeero@msn.com>
- Cc: xmlschema-dev@w3.org
Hi Ciprian, Actually your DTD is not valid, see [1] <quote source="http://www.w3.org/TR/2004/REC-xml-20040204/#sec-element-content"> For compatibility, it is an error if the content model allows an element to match more than one occurrence of an element type in the content model. For more information, see E Deterministic Content Models. </quote> and further [2] However, as Tim Bray notes [3] in his annotated XML specification [4] this rule will not generally be checked by XML processors. In general the solution is to write the DTD so that it is deterministic, in your case the grammar accepts: STOCKS STOCKS, PRICE STOCKS, STOCKS, PRICE ... KIT, STOCKS You can write it as (KIT, STOCKS) | (STOCKS+, Price?) [1] http://www.w3.org/TR/2004/REC-xml-20040204/#sec-element-content [2] http://www.w3.org/TR/2004/REC-xml-20040204/#determinism [3] http://www.xml.com/axml/notes/Determinism.html [4] http://www.xml.com/axml/testaxml.htm Best Regards, George ----------------------------------------------- George Cristian Bina <oXygen/> XML Editor & XSLT Editor/Debugger http://www.oxygenxml.com Ciprian Ciubotariu wrote: > Should I also understand that DTDs are not fully convertible to XML schemas? > Here's an excerpt of a DTD: > > <!ELEMENT ... ((KIT? , STOCKS) | (STOCKS+ , PRICE , ...)) > > and here is an excerpt of the XSD generated with oXygen (I found it in your > signature) > > <xs:choice> > <xs:sequence> > <xs:element minOccurs="0" ref="KIT"/> > <xs:element ref="STOCKS"/> > </xs:sequence> > <xs:sequence> > <xs:element maxOccurs="unbounded" ref="STOCKS"/> > .... > </xs:sequence> > </xs:choice> > > As you can see, it is almost the same situation as above. Or is it that the > DTD is not valid? oXygen says it is valid, and I have no further knowledge > on this issue. As a regular expression it is very valid (at least imo) > > Regards, > > Cipi > > "George Cristian Bina" <george@sync.ro> wrote in message > news:41121214.90003@sync.ro... > >>Hi Ciprian, >> >> > I planned to use the following in a schema: inside an <choice> group >>having >> > several elements with the same name but different types. Can I write >>this in >> > a schema? >>[...] >> > 1. Is this construction allowed by the W3C schema specifications? >> >>No, you cannot do this in a W3C XML Schema. >>See http://www.w3.org/TR/xmlschema-1/#cos-element-consistent for details. >> >>Best Regards, >>George >>----------------------------------------------- >>George Cristian Bina >><oXygen/> XML Editor & XSLT Editor/Debugger >>http://www.oxygenxml.com >> >> > > >
Received on Thursday, 5 August 2004 10:34:48 UTC