- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 18 Nov 2002 18:56:01 +0000
- To: "Stuart Brown" <sepenidur@hotmail.com>
- Cc: xmlschema-dev@w3.org
"Stuart Brown" <sepenidur@hotmail.com> writes: > I'm newish to XSD, and am having some trouble with converting DTD > mixed content element into mixed complex types that reference > groups. Having tracked through the archives I'm kind of getting an > idea of the problem, but I'm still stuck as to a solution. No need to apologise -- you have done everything right. > Say I had a DTD fragment like so: > > <!ENTITY % foo "a | b | c"> > <!ELEMENT z (#PCDATA | %foo; | d)*> > > and for argument's sake a, b, c are PCDATA only and d implements a > defined complex type. > > The datatype of (PCDATA | %foo | d) reoccurs in other elements, as > does %foo alone, so I have designed the schema equivalent as follows: > > <xsd:group name="foo"> > <xsd:choice> > <xsd:element name="a" type="xsd:string"/> > <xsd:element name="b" type="xsd:string"/> > <xsd:element name="c" type="xsd:string"/> > </xsd:choice> > </xsd:group> > <xsd:complexType name="dType"> > <!-- etc... --> > </xsd:complexType> > <xsd:complexType name="zType" mixed="true"> > <xsd:choice minOccurs="0" maxOccurs="unbounded"> > <xsd:group ref="foo"/> > <xsd:element name="d" type="dType"/> > </xsd:choice> > </xsd:complexType> > <xsd:element name="z" type="zType"/> That looks fine to me, and it works with your instance with XSV [1]. > Then all string data after the first occurrence of a child element is > rejected (by XMLSpy) with the message: Text not allowed inside element > " > Any advice on how I can reference group/choice fragments in a mixed > content complex type? Use a different validator :-). Seriously, this looks like a problem with XML Spy, unless I'm missing something. ht [1] http://www.w3.org/2001/03/webdata/xsv -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh W3C Fellow 1999--2002, part-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/ [mail really from me _always_ has this .sig -- mail without it is forged spam]
Received on Monday, 18 November 2002 13:56:03 UTC