[ 
https://issues.apache.org/jira/browse/XERCESC-1610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Boris Kolpackov closed XERCESC-1610.
------------------------------------

    Resolution: Duplicate

Duplicate of XERCESC-1810

> Validator incorrectly rejects XML
> ---------------------------------
>
>                 Key: XERCESC-1610
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1610
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (XML Schema)
>    Affects Versions: 2.7.0
>         Environment: Linux (Debian Etch)
>            Reporter: Edsko de Vries
>
> Consider the following XML schema:
> <?xml version="1.0"?>
> <xs:schema
>     xmlns:xs="http://www.w3.org/2001/XMLSchema";
>     xmlns="http://testcase";
>     targetNamespace="http://testcase";
>     elementFormDefault="qualified">
> <xs:element name="root">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="a" type="xs:string"/>
> <xs:element name="a" type="xs:string" nillable="true"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> And the following XML test instance:<?xml version="1.0"?>
> <root xmlns="http://testcase"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xsi:schemaLocation="http://testcase schema.xsd">
>     <a>a</a>
>     <a xsi:nil="true" />
> </root>
> This yields the following (incorrect) error:
> Error at file test.xml, line 4, char 22
>   Message: xsi:nil must not be specified for the element a with nillable 
> equals false
> Interestingly, when the schema (and the instance document) is modified so 
> that the two tags are reversed:
> ...
> <xs:element name="a" type="xs:string" nillable="true"/>
> <xs:element name="a" type="xs:string"/>
> ...
> the document _does_ validate fine. However, with this schema, when the 
> instance document is modified to
> <?xml version="1.0"?>
> <root xmlns="http://testcase"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xsi:schemaLocation="http://testcase schema.xsd">
>     <a xsi:nil="true" />
>     <a xsi:nil="true" />
> </root>
> the document _still_ validates! (whereas of course it should no longer 
> validate).
> Guess: It appears the nillability of <a> is stored the first time an <a> is 
> encountered; so, when the first <a> is not nillable, Xerces thinks that all 
> <a>s must not be nillable, but when the first <a> is nillable, it thinks all 
> <a> may be nillable. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to