[relaxng-user] problems with trang making xsd, mixed="true"

Eric van der Vlist vdv at dyomedea.com
Tue Nov 30 08:09:55 ICT 2004


Hi Sebastian,

On Mon, 2004-11-29 at 23:56 +0000, Sebastian Rahtz wrote:
> My schema has this:
> 
>   <rng:define name="docAuthor">
>     <rng:element name="docAuthor">
>       <rng:ref name="macro.phraseSeq"/>
>       <rng:ref name="docAuthor.attributes"/>
>     </rng:element>
>   </rng:define>
> 
> where macro.phraseSeq is
> 
>   <rng:define name="macro.phraseSeq">
>     <rng:zeroOrMore>
>       <rng:ref name="macro.phrasegroup"/>
>     </rng:zeroOrMore>
>   </rng:define>
> 
> 
> This translate with trang into
> 
>   <xsd:element name="docAuthor">
>     <xsd:complexType>
>       <xsd:complexContent>
>         <xsd:extension base="ns1:macro.phraseSeq">
>           <xsd:attributeGroup ref="ns1:docAuthor.attributes"/>
>         </xsd:extension>
>       </xsd:complexContent>
>     </xsd:complexType>
>   </xsd:element>
> 
> and
> 
>   <xsd:complexType name="macro.phraseSeq" mixed="true">
>     <xsd:group minOccurs="0" maxOccurs="unbounded" 
> ref="ns1:macro.phrasegroup"/>
>   </xsd:complexType>
> 
> which looks fine. Most tests pass it OK.
> But the Microsoft parser says "The derived type and the base type
> must have the same content type" because docAuthor does not say
> it is "mixed='true'".
> 
> Can anyone explain to me
> 
>  a) is Microsoft correct?

With W3C XML Schema, it's always difficult to be sure but here is what I
have written on the subject a while ago :

http://lists.w3.org/Archives/Public/xmlschema-dev/2001Oct/0113.html


Also, http://w3.org/TR/xmlschema-1/#Complex_Type_Definitions says:

<quote>
[Definition:]  Let the effective mixed be  the appropriate case among
the following:
1.1 If the mixed [attribute] is present on <complexContent>, then its
·actual value·;
1.2 If the mixed [attribute] is present on <complexType>, then its
·actual value·;
1.3 otherwise false.
</quote>

and later on :

<quote>
1.4.3.2.2.1 Both {content type}s must be mixed or both must be
element-only.
</quote>

To make it short, I *think* that on this one, Microsoft is right and
trang is wrong.

>  b) whether I can fix this in any way, short of writing a transform of
>  the XSD?

What about trying to isolate a simpler repro case and 

a) send a mail to James Clark
b) see if by rewriting the RNG schema you can work around this behavior

???

> yours depressed by Microsoft again

That's depressing for sure but in that case, I find W3C XML Schema the
depressing factor, not Microsoft!

Hope this helps.

Eric

> Sebastian
> 
-- 
Read me on Advogato.
                                         http://advogato.org/person/vdv/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------



More information about the relaxng-user mailing list