You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Scott Cantor (JIRA)" <xe...@xml.apache.org> on 2017/07/07 20:37:00 UTC
[jira] [Commented] (XERCESC-1881) xsd sequence validation reporting
errors too late
[ https://issues.apache.org/jira/browse/XERCESC-1881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16078632#comment-16078632 ]
Scott Cantor commented on XERCESC-1881:
---------------------------------------
Moving out, no way this is in scope for 3.2.
> 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>chief@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>chief@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>chief@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-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org