Re: conplexType with mixed="true" and no content.

Ross,

> KAZUMI Saito writes:
>  > >From my read of the schema recomenndation, following xml instance
>  > is not valid against that schema.
>  > 
>  > XSD:
>  > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>  >   <xs:element name="root">
>  >     <xs:complexType mixed="true"/>
>  >   </xs:element>
>  > </xs:schema>
>  > 
>  > XML:
>  > <root>text</root>
>  > 
>  > Because, the rec says in "Complex Type Definition with complex content
>  > Schema Component", 
>  > 
>  > {content type}:
>
> The part you left out was
>  1 If the <restriction> alternative is chosen, then the appropriate
>    case among the following:
[snip]
> So 1.1.1 only applies if you are doing restriction, which the example
> does not.  So 1.2.1 applies.

If you have an empty xs:complexType, as Kazumi has, then it's
equivalent to restricting the ur-type (xs:anyType) by restriction:

  The property mappings below are also used in the case where the
  third alternative (neither <simpleContent> nor <complexContent>) is
  chosen. This case is understood as shorthand for complex content
  restricting the ·ur-type definition·, and the details of the
  mappings should be modified as necessary.

                        http://www.w3.org/TR/xmlschema-1/#declare-type

The structure of the description is:

  1 If the <restriction> alternative is chosen, then the appropriate
    case among the following:
    1.1 If one of the following is true
      1.1.1 There is no <group>, <all>, <choice> or <sequence> among
            the [children];
      1.1.2 ...
      1.1.3 ...
      , then empty;
    1.2 otherwise a pair consisting of...

  2 If the <extension> alternative is chosen, then...

You first have to choose between 1 and 2. If it's a restriction then
choose 1, if it's an extension choose 2. If you choose 1, you then
have to choose between 1.1 and 1.2. If 1.1.1, 1.1.2 or 1.1.3 is true,
then choose 1.1, otherwise choose 1.2.

In this case, we choose restriction, and 1.1.1 is true, so the content
of the complex type is empty. So I think that Kazumi is correct that
the root element having content is invalid.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Thursday, 11 April 2002 11:17:40 UTC