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

Eric van der Vlist vdv at dyomedea.com
Tue Nov 30 10:54:19 ICT 2004


On Tue, 2004-11-30 at 09:22 +0000, Sebastian Rahtz wrote:
> Eric van der Vlist wrote:
> 
> ><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.
> >  
> >
> Good lord. can such things be? 

That's the result of an overly complex spec that nobody can read :-( ...
This whole thread is just yet another demonstration that this should be
avoided!

> anyway, thanks for the explanation.

And sorry I was wrong...

> I guess its fairly immaterial whether Microsoft are right or wrong,
> as I don't suppose they produce fixes to such things very quickly,
> so  I have to work around it.
> 
> >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
> >  
> >
> the latter is what I was looking at. I have solved some of my cases
> in this way, but have a few nasties left over.

And this one seems especially nasty.

Don't know if this can help, but the simplest repro I can think of is
something like:

start = element foo {foo}

foo = foo.elements, foo.attributes

foo.elements = mixed{element bar {empty}}

foo.attributes = attribute bat {text}

And the generated schema shows the behaviour you've noticed:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
  <xs:element name="foo" type="foo"/>
  <xs:complexType name="foo">
    <xs:complexContent>
      <xs:extension base="foo.elements">
        <xs:attributeGroup ref="foo.attributes"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
  <xs:complexType name="foo.elements" mixed="true">
    <xs:sequence>
      <xs:element ref="bar"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="bar">
    <xs:complexType/>
  </xs:element>
  <xs:attributeGroup name="foo.attributes">
    <xs:attribute name="bat" use="required"/>
  </xs:attributeGroup>
</xs:schema>

> I suspect James would say that he is not going to make Trang
> work around bugs in other people's software :-}

Trang is already a work around bugs in other people's language!

Eric

> 
> Sebastian
> 
> 
-- 
Have you ever thought about unit testing XSLT templates?
                                                     http://xsltunit.org
------------------------------------------------------------------------
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