[ 
https://issues.apache.org/jira/browse/XERCESC-1736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12519458
 ] 

Jesse Pelton commented on XERCESC-1736:
---------------------------------------

I used the DOMPrint sample app with the following command line:

  DOMPrint -n -s -f -v=always output.xml

When I ran it against the original output.xml, I got the following output:

  Error at file "D:\test/output.xml", line 2, column 157
     Message: Unknown element 'DataObject'

I then removed the default namespace, so the second line of the document became 
as follows:

  <DataObject xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"; 
xs:noNamespaceSchemaLocation="datasetSchema.xsd">

DOMPrint then produce the following, which looks correct to me:

  Error at file "D:\test/output.xml", line 14, column 11
     Message: Unknown element 'key1'
  Error at file "D:\test/output.xml", line 17, column 20
     Message: Element 'key1' is not valid for content model: '((key,age),info)'
  Error at file "D:\test/output.xml", line 19, column 11
     Message: Unknown element 'key1'
  Error at file "D:\test/output.xml", line 22, column 20
     Message: Element 'key1' is not valid for content model: '((key,age),info)'

I got the same results with both v2.5 and v2.7 of the software. I was 
apparently wrong about the need to change the schema URI on my machine.

> xml document validation againsta schema
> ---------------------------------------
>
>                 Key: XERCESC-1736
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1736
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (DTD), Validating Parser (Schema) 
> (Xerces 1.5 or up only)
>    Affects Versions: 2.7.0
>         Environment: Windows XP professional
> Visual Studio 2005
>            Reporter: Denis Tkachov
>
> Instances of both  XercesDOMParser and  SAX2XMLReader threat all the 
> documents as valid even if a document does not match schema provided.
> In order if document does not match schema provided the library does not 
> throw exception and getErrorCount method of the parser returns zero.
> So it seems to be a bug in the library.
>  As example you can try this code: 
> http://xml.apache.org/xerces-c/program-dom.html#ConstructXercesDOMParser
> Below are provided scheme and document (error marked with "does not match 
> schema" comment) that reproduces error:
> datasetSchema.xsd:
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
>       <xs:element name="DataObject">
>               <xs:complexType>
>                       <xs:choice minOccurs="0" maxOccurs="unbounded">
>                               <xs:element name="MasterDataTable">
>                                       <xs:complexType>
>                                               <xs:sequence>
>                                                       <xs:element name="key" 
> type="xs:int"/>
>                                                       <xs:element name="name" 
> type="xs:string"/>
>                                                       <xs:element 
> name="surname" type="xs:string"/>
>                                               </xs:sequence>
>                                       </xs:complexType>
>                               </xs:element>
>                               <xs:element name="ChildDataTable">
>                                       <xs:complexType>
>                                               <xs:sequence>
>                                                       <xs:element name="key" 
> type="xs:int"/>
>                                                       <xs:element name="age" 
> type="xs:string"/>
>                                                       <xs:element name="info" 
> type="xs:string"/>
>                                               </xs:sequence>
>                                       </xs:complexType>
>                               </xs:element>
>                       </xs:choice>
>               </xs:complexType>
>       </xs:element>
> </xs:schema>
> output.xml:
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> <DataObject xmlns="http://creopod.com/DataObject.xsd"; 
> xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"; 
> xs:noNamespaceSchemaLocation="datasetSchema.xsd">
>   <MasterDataTable>
>     <key>1</key>
>     <name>Vasya</name>
>     <surname>Pupkin</surname>
>   </MasterDataTable>
>   <MasterDataTable>
>     <key>2</key>
>     <name>Petro</name>
>     <surname>Kukurudza</surname>
>   </MasterDataTable>
>   <ChildDataTable>
>     <key1>1</key1> <!-- does not match schema-->
>     <age>23</age>
>     <info>famous guy</info>
>   </ChildDataTable>
>   <ChildDataTable>
>     <key1>2</key1> <!-- does not match schema-->
>     <age>29</age>
>     <info></info>
>   </ChildDataTable>
> </DataObject>

-- 
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