W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2003

Re: complexType question

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 20 Jun 2003 16:10:06 +0100
To: "Michael Ryan Bannon" <mrbannon@uwaterloo.ca>
Cc: <xmlschema-dev@w3.org>
Message-ID: <f5bhe6kss35.fsf@erasmus.inf.ed.ac.uk>

"Michael Ryan Bannon" <mrbannon@uwaterloo.ca> writes:

> Forgive me for asking this...I'm finding the structures doc to be a difficult read.
> Can a complexType contain bothe elemnts and simpleContent?  For example, could a schema be constructed that allows the follwoing instance?
> <foo>
>     <bar>
>     </bar>
>     f*ed up beyond all recognition
> </foo>

No and yes :-)

XML Schema allows mixed content, with full flexibility of the
configuration of elements allowed.  But the text allowed thereby is
not typed.

E.g. to reconstruct <!ELEMENT foo (bar|mum|#PCDATA)*> we would write

<xs:complexType mixed='true'>
 <xs:choice minOccurs="0" maxOccurs="unbounded">
  <xs:element name="bar"/>
  <xs:element name="mum"/>

  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
                      Half-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 Friday, 20 June 2003 11:10:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:11 UTC