RE: managing unknown values

This is strange...

I initially used XML-Spy to validate the document.  And it parsed without a
problem.

I have now tested the document using Xerces 1.4.2 and started experiencing
the same problem as you.

Out of curiosity, I reversed the order of the foo and bar elements in both
the schema and instance documents, and the instance parsed without error
under Xrces 1.4.2.

I am unable to comment as to why it should fail when the foo element is
first in the list.
Maybe one of the Xerces developers or someone that knows the Schema spec
better can comment.


Steve

-----Original Message-----
From: Guillaume Rousse [mailto:rousse@ccr.jussieu.fr]
Sent: 10 September 2001 hh:mm:ss 13:14
To: Bailey, Stephen; xmlschema-dev@w3.org
Subject: Re: managing unknown values


Ainsi parlait Bailey, Stephen :
> Guillaume,
>
> I don't fully understand what the error message is saying, I would expect
> an error message that indicates that the parser found an unexpected
element
> because, from my understanding, the instance document can only contain
> either an element of 'foo' or an element of 'bar', not both.
I don't understand it also, however:
-foo and bar should be totaly independent (in theory)
-presence or absence of foo (in reality) triggers the message vs bad

> Try the following schema and instance documents and see if it has the
> desired effect.  I have creates a root element called 'test' that includes
> both foo and bar as children.
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
> 	<xs:complexType name="KeyRefType">
> 		<xs:attribute name="idref" type="xs:string"/>
> 	</xs:complexType>
>
> 	<xs:complexType name="test">
> 		<xs:sequence>
> 			<xs:element name="foo" type="KeyRefType"
> nillable="true"/>
> 			<xs:element name="bar" type="KeyRefType"/>
> 		</xs:sequence>
> 	</xs:complexType>
>
> 	<xs:element name="test" type="test"/>
> </xs:schema>
I just modified foo and bar element to allow non-occurence (minOccur="0")

With following instance:
<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="schema.xsd">
        <foo xsi:nil="true"/>
        <bar idref="idx"/>
</test>
[guillaume@silbermann guillaume]$ xml-check instance.xml
[Error] instance.xml:4:27: General Schema Error: xsi:nil must not be 
specified for the element bar with {nillable} equals 'false'.
instance.xml: 649 ms (3 elems, 4 attrs, 19 spaces, 0 chars)

With following instance:
<?xml version="1.0" encoding="UTF-8"?>
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="schema.xsd">
        <bar idref="idx"/>
</test>
[guillaume@silbermann guillaume]$ xml-check instance.xml
instance.xml: 631 ms (2 elems, 3 attrs, 10 spaces, 0 chars)
-- 
Guillaume Rousse <rousse@ccr.jussieu.fr>
GPG key http://lis.snv.jussieu.fr/~rousse/gpgkey.html

Received on Monday, 10 September 2001 14:31:48 UTC