W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2004

Re: Which elements in mixed="true"?

From: <noah_mendelsohn@us.ibm.com>
Date: Thu, 19 Aug 2004 10:38:06 -0400
To: Thomas Solbjør <thomas.solbjor@strath.ac.uk>
Cc: xmlschema-dev@w3.org
Message-ID: <OF7C363129.B8175D26-ON85256EF5.005019AA@lotus.com>

Thomas Solbjør asks:

>> Does the XML Instance document support elements within 
>> an element with: mixed="true"?

>> I'm thinking about formatting elements such as "<b>", 
>> "<h1>" etc.

Not sure which of two sorts of nesting you mean:

  <b>Maybe some text here?</b>

Is supported, but does not involve "mixed content".  You have a 
declaration along the lines of:

<xsd:element name="a">
        <xsd:element ref="b"/>

If you mean nested in text then you do use mixed content:

<a>This text has <b>mixed</b> content <a/>

<xsd:element name="a">
  <!-- allow content to be mixed into text -->
  <xsd:complexType mixed="true">
        <xsd:element ref="b"/>

As noted in an earlier reply, the way schema implements mixed is that it 
ignores the text children of <a> and validates as if the instance were:


So, you get all the flexibility of sequences, choices, etc., but 
interspersed into text if you like.  Hope this helps.

Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
Received on Thursday, 19 August 2004 14:40:54 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:06 UTC