You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Lachlan Paterson <la...@post.com> on 2004/07/05 21:04:54 UTC

scomp does not validate properly?

I attempted to run scomp, using a simple schema that contains a choice between two sequences, and I received this error:

"Content model violates the unique particle attribution rule"

But using this:
http://www.w3.org/2001/03/webdata/xsv
...it is valid.

and, interestingly, using this:
http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx
...it is not valid.

I think it should be valid. This is the schema:

<xs:schema
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   elementFormDefault="qualified">

<xs:element name="x" type="MyType"/>

<xs:complexType name="MyType">
  <xs:choice>
    <xs:sequence>
      <xs:element name="a" type="xs:string"/>
      <xs:element name="b" type="xs:string"/>
      <xs:element name="c" type="xs:string"/>
    </xs:sequence>
    <xs:sequence>
      <xs:element name="a" type="xs:string"/>
      <xs:element name="b" type="xs:string"/>
      <xs:element name="d" type="xs:string"/>
    </xs:sequence>
  </xs:choice>
</xs:complexType>

</xs:schema>

- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


order of elements in a sequence

Posted by Nikhil Dinesh <ni...@seas.upenn.edu>.
Hi,

Im having trouble getting XmlBeans to save the elements of a sequence in
order. I have a complex type defined similar to the following:

<complexType name="fooId>
  <attribute name="id" type="ID" />
</complexType>

<complexType name="fooId2">
  <complexContent>
    <extension base="fooId">
      <attribute name="type" type="string" />
    </extension>
  </complexContent>
</complexType>

<complextType name="fooInstance">
  <complexContent>
    <extension base="fooId">
      <sequence>
        <element name="a" type="fooId" minOccurs="0" maxOccurs="unbounded"/>
        <element name="b" type="fooId2" minOccurs="0" maxOccurs="unbounded"/>
      </sequence>
    </extension>
  </complexContent>
</complexType>

A file is read in such that all the "<a>'s" occur before the "<b>'s". This
is done by messaging the contentHandler. But when I try to save it, the
a's and b's are interspersed.

Ive tried setting minOccurs=maxOccurs=1 on the sequence element. Doesnt
that guarantee that it will be split into atmost one subsequence as per
the W3c recommendation? But that doesnt work either.

The sequence order is needed because the persistent form of the XML needs
to be compatible with a DTD. I could of course walk over the tree, but
that seems like a very bad solution.

Any suggestions?

Thanks,
Nikhil



- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


order of elements in a sequence

Posted by Nikhil Dinesh <ni...@seas.upenn.edu>.
Hi,

Im having trouble getting XmlBeans to save the elements of a sequence in
order. I have a complex type defined similar to the following:

<complexType name="fooId>
  <attribute name="id" type="ID" />
</complexType>

<complexType name="fooId2">
  <complexContent>
    <extension base="fooId">
      <attribute name="type" type="string" />
    </extension>
  </complexContent>
</complexType>

<complextType name="fooInstance">
  <complexContent>
    <extension base="fooId">
      <sequence>
        <element name="a" type="fooId" minOccurs="0" maxOccurs="unbounded"/>
        <element name="b" type="fooId2" minOccurs="0" maxOccurs="unbounded"/>
      </sequence>
    </extension>
  </complexContent>
</complexType>

A file is read in such that all the "<a>'s" occur before the "<b>'s". This
is done by messaging the contentHandler. But when I try to save it, the
a's and b's are interspersed.

Ive tried setting minOccurs=maxOccurs=1 on the sequence element. Doesnt
that guarantee that it will be split into atmost one subsequence as per
the W3c recommendation? But that doesnt work either.

The sequence order is needed because the persistent form of the XML needs
to be compatible with a DTD. I could of course walk over the tree, but
that seems like a very bad solution.

Any suggestions?

Thanks,
Nikhil



- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: scomp does not validate properly?

Posted by Mik Lernout <mi...@futurestreet.org>.
Lachlan,

It is very strange that the XSV validator does not catch this error as 
it is definitely invalid. The basic premise is that when there is a 
choice, there can be no particles in its options that can be ambitious: 
for an element to be valid for a choice, the validator must be able to 
determine in the very beginning to which of the different choices it 
should match...

A less confusing explanation can be found in the Spec: 
http://www.w3.org/TR/xmlschema-1/#non-ambig

Mik


Lachlan Paterson wrote:

>I attempted to run scomp, using a simple schema that contains a choice between two sequences, and I received this error:
>
>"Content model violates the unique particle attribution rule"
>
>But using this:
>http://www.w3.org/2001/03/webdata/xsv
>...it is valid.
>
>and, interestingly, using this:
>http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx
>...it is not valid.
>
>I think it should be valid. This is the schema:
>
><xs:schema
>   xmlns:xs="http://www.w3.org/2001/XMLSchema"
>   elementFormDefault="qualified">
>
><xs:element name="x" type="MyType"/>
>
><xs:complexType name="MyType">
>  <xs:choice>
>    <xs:sequence>
>      <xs:element name="a" type="xs:string"/>
>      <xs:element name="b" type="xs:string"/>
>      <xs:element name="c" type="xs:string"/>
>    </xs:sequence>
>    <xs:sequence>
>      <xs:element name="a" type="xs:string"/>
>      <xs:element name="b" type="xs:string"/>
>      <xs:element name="d" type="xs:string"/>
>    </xs:sequence>
>  </xs:choice>
></xs:complexType>
>
></xs:schema>
>
>- ---------------------------------------------------------------------
>To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
>Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>
>  
>


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Re: scomp does not validate properly?

Posted by Mik Lernout <mi...@futurestreet.org>.
Lachlan,

It is very strange that the XSV validator does not catch this error as 
it is definitely invalid. The basic premise is that when there is a 
choice, there can be no particles in its options that can be ambitious: 
for an element to be valid for a choice, the validator must be able to 
determine in the very beginning to which of the different choices it 
should match...

A less confusing explanation can be found in the Spec: 
http://www.w3.org/TR/xmlschema-1/#non-ambig

Mik


Lachlan Paterson wrote:

>I attempted to run scomp, using a simple schema that contains a choice between two sequences, and I received this error:
>
>"Content model violates the unique particle attribution rule"
>
>But using this:
>http://www.w3.org/2001/03/webdata/xsv
>...it is valid.
>
>and, interestingly, using this:
>http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx
>...it is not valid.
>
>I think it should be valid. This is the schema:
>
><xs:schema
>   xmlns:xs="http://www.w3.org/2001/XMLSchema"
>   elementFormDefault="qualified">
>
><xs:element name="x" type="MyType"/>
>
><xs:complexType name="MyType">
>  <xs:choice>
>    <xs:sequence>
>      <xs:element name="a" type="xs:string"/>
>      <xs:element name="b" type="xs:string"/>
>      <xs:element name="c" type="xs:string"/>
>    </xs:sequence>
>    <xs:sequence>
>      <xs:element name="a" type="xs:string"/>
>      <xs:element name="b" type="xs:string"/>
>      <xs:element name="d" type="xs:string"/>
>    </xs:sequence>
>  </xs:choice>
></xs:complexType>
>
></xs:schema>
>
>- ---------------------------------------------------------------------
>To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
>For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
>Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
>
>  
>


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/