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

Scott Cantor updated XERCESC-1881:
----------------------------------
    Fix Version/s:     (was: 3.2.0)

> xsd sequence validation reporting errors too late
> -------------------------------------------------
>
>                 Key: XERCESC-1881
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1881
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (XML Schema)
>    Affects Versions: 3.0.0, 3.0.1, 3.1.0, 3.1.1, 3.1.2, 3.2.0, 3.1.3, 3.1.4
>         Environment: Windows Visaa 32, Xerces 3.0.1
>            Reporter: Brian Hoyt
>             Fix For: 4.0.0
>
>
> Validation using the following xsd and xml results in two different results 
> between XercesJ and XercesC++.
> For java I get the error reporting the sequence error right after the 
> processing of element <url> because <name>
> cannot appear after <url>. But for C++ the error is not reported until the 
> last element within <person> has been
> processed. This obviously isn't correct because by that time it is too late. 
> The way Java is reporting it seems to 
> be correct so that I can stop processing the xml file. 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
>    <xs:element name="person">
>        <xs:complexType>
>            <xs:sequence>
>                  <xs:element name="name"  type='xs:string' minOccurs='0' 
> maxOccurs='1'/>
>                  <xs:element name="email"  type='xs:string' minOccurs='0' 
> maxOccurs='unbounded'/>
>                  <xs:element name="url"    type='xs:string' minOccurs='0' 
> maxOccurs='unbounded'/>
>                  <xs:element name="link"   type='xs:string' minOccurs='0' 
> maxOccurs='1'/>
>            </xs:sequence>
>        </xs:complexType>
>     </xs:element>
> </xs:schema>
> <?xml version="1.0" encoding="UTF-8"?>
> <person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>            xsi:noNamespaceSchemaLocation='foo.xsd'>
>     <url>www.foo.com</url>
>     <name>Boss</name>
>     <email>ch...@foo.com</email>
>     <link/>
> </person>
> The output from running the XercesJ 2.9.1 Writer sample on the above xsd/xml 
> is:
> <person xsi:noNamespaceSchemaLocation="foo.xsd">
>     <url>www.foo.com</url>
>     [Error] foo.xml:5:11: cvc-complex-type.2.4.a: Invalid content was found 
> star
> ting with element 'name'. One of '{url, link}' is expected.
> <name>Boss</name>
>     <email>ch...@foo.com</email>
>     <link></link>
> </person>
> The output from running the XercesC++ 3.0.1 
> <?xml version="1.0" encoding="LATIN1"?>
> <person xsi:noNamespaceSchemaLocation="foo.xsd">
>     <url>www.foo.com</url>
>     <name>Boss</name>
>     <email>ch...@foo.com</email>
>     <link></link>
> Error at file C:\xerces-3_0_1\bin/foo.xml, line 8, char 10
>   Message: element 'name' is not allowed for content model 
> '((name,email,url),li
> nk)'
> </person>



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to