Re: complexType question

"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"/>
 </xs:choice>
</xs:complexType>

ht
-- 
  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