Re: Which elements in mixed="true"?

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:

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

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

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

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:sequence>
        <xsd:element ref="b"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>

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:

<a><b>mixed</b><a/>

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
1-617-693-4036
--------------------------------------

Received on Thursday, 19 August 2004 14:40:54 UTC