You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Dominik Holler <Do...@gmx.net> on 2008/04/03 16:58:44 UTC

xerces (-c + -j) does not validate a xml file against schema

Hello,
I discovered a strage behaviour in the c++ and java implementation of 
xerces.
I want to validate a xml file against a schema, the example file and the 
schema files are part of the stabdard "(FBX) FIBEX - Field Bus Exchange 
Format" [1]. MSXML does validate the file successful, and I does not see 
a error in the file, too.

The root element of the file FlexRay_Cluster_Example.xml has the attribute

xsi:schemaLocation="http://www.asam.net/xml/fbx/all fibex4multiplatform.xsd"

.
The validation with xerces-c via
SAX2Count.exe -v=always -p -f
results to

Error at file F:\xxx\fibex/FlexRay_Cluster_Example.xml, line 120, char 52
   Message: Unknown element 'fx:PDU-TRIGGERING'

Error at file F:\xxx\fibex/FlexRay_Cluster_Example.xml, line 120, char 52
   Message: Attribute 'ID' is not declared for element 'fx:PDU-TRIGGERING'

Error at file F:\xxx\fibex/FlexRay_Cluster_Example.xml, line 124, char 52
   Message: Unknown element 'fx:PDU-TRIGGERING'

Error at file F:\xxx\fibex/FlexRay_Cluster_Example.xml, line 124, char 52
   Message: Attribute 'ID' is not declared for element 'fx:PDU-TRIGGERING'

Error at file F:\xxx\fibex/FlexRay_Cluster_Example.xml, line 154, char 52
   Message: Unknown element 'fx:PDU-TRIGGERING'
...

The validation with xerces-j via
sax.Counter -n -np -v -s -f -hs -va
results to

[Error] FlexRay_Cluster_Example.xml:33:55: cvc-elt.1: Cannot find the 
declaration of element 'fx:FIBEX'.
[Error] FlexRay_Cluster_Example.xml:40:76: cvc-elt.4.2: Cannot resolve 
'flexray:CLUSTER-TYPE' to a type definition for element 'fx:CLUSTER'.
...

Because fibex4multiplatform.xsd imorts fibex4flexray.xsd and fibex.xsd, 
the schemaLocation of the root element of the xml file is changed to

xsi:schemaLocation="http://www.asam.net/xml/fbx/flexray 
fibex4flexray.xsd http://www.asam.net/xml/fbx fibex.xsd"

sax.Counter of xerces-j validates the xml now successful:
FlexRay_Cluster_Example.xml: 1060 ms (961 elems, 369 attrs, 0 spaces, 
19497 chars)

and xerces-c is producing the same errors, and my application will be 
written in c++.

Any ideas describing the mysterious behaviour of xerces?

regards

dominik holler




[1]
   http://www.asam.net/03_standards_06.php

Re: xerces (-c + -j) does not validate a xml file against schema

Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Hi Dominik,

Dominik Holler <Do...@gmx.net> writes:

> the schemaLocation of the root element of the xml file is changed to
>
> xsi:schemaLocation="http://www.asam.net/xml/fbx/flexray
> fibex4flexray.xsd http://www.asam.net/xml/fbx fibex.xsd"

I don't see why there are still errors after this change. Can
you file a bug report so that we can try to fix it for 3.0.0?
Please provide all the information you provided in this email
as well as the link to the schemas and example:

http://xerces.apache.org/xerces-c/bug-report.html

Thanks,
Boris

-- 
Boris Kolpackov, Code Synthesis Tools
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde

Re: xerces (-c + -j) does not validate a xml file against schema

Posted by Dominik Holler <Do...@gmx.net>.
David Cargill schrieb:
> Hi,
> For java you are specifing -hs "Turn on/off honouring of all schema
> locations."
> 
> The SAX2Count sample doesn't have an option to set this.  Try adding
> 
> parser->setFeature(XMLUni::fgXercesHandleMultipleImports, true);
> 
> and see if that helps.  I think it was added after Xerces-C 2.8 was
> released.
> 

thanks for repling. the "fgXercesHandleMultipleImports" does not change 
anything

regards
dominik

Re: xerces (-c + -j) does not validate a xml file against schema

Posted by David Cargill <ca...@ca.ibm.com>.
Hi,
For java you are specifing -hs "Turn on/off honouring of all schema
locations."

The SAX2Count sample doesn't have an option to set this.  Try adding

parser->setFeature(XMLUni::fgXercesHandleMultipleImports, true);

and see if that helps.  I think it was added after Xerces-C 2.8 was
released.

Regards,
David A. Cargill
XML Parser Development
IBM Toronto Lab
(905) 413-2371, tie 969
cargilld@ca.ibm.com


                                                                           
             Dominik Holler                                                
             <Dominik.Holler@g                                             
             mx.net>                                                    To 
                                       c-users@xerces.apache.org           
             04/03/2008 10:58                                           cc 
             AM                                                            
                                                                   Subject 
                                       xerces (-c + -j)  does not validate 
             Please respond to         a xml file against schema           
             c-users@xerces.ap                                             
                 ache.org                                                  
                                                                           
                                                                           
                                                                           
                                                                           




Hello,
I discovered a strage behaviour in the c++ and java implementation of
xerces.
I want to validate a xml file against a schema, the example file and the
schema files are part of the stabdard "(FBX) FIBEX - Field Bus Exchange
Format" [1]. MSXML does validate the file successful, and I does not see
a error in the file, too.

The root element of the file FlexRay_Cluster_Example.xml has the attribute

xsi:schemaLocation="http://www.asam.net/xml/fbx/all
fibex4multiplatform.xsd"

.
The validation with xerces-c via
SAX2Count.exe -v=always -p -f
results to

Error at file F:\xxx\fibex/FlexRay_Cluster_Example.xml, line 120, char 52
   Message: Unknown element 'fx:PDU-TRIGGERING'

Error at file F:\xxx\fibex/FlexRay_Cluster_Example.xml, line 120, char 52
   Message: Attribute 'ID' is not declared for element 'fx:PDU-TRIGGERING'

Error at file F:\xxx\fibex/FlexRay_Cluster_Example.xml, line 124, char 52
   Message: Unknown element 'fx:PDU-TRIGGERING'

Error at file F:\xxx\fibex/FlexRay_Cluster_Example.xml, line 124, char 52
   Message: Attribute 'ID' is not declared for element 'fx:PDU-TRIGGERING'

Error at file F:\xxx\fibex/FlexRay_Cluster_Example.xml, line 154, char 52
   Message: Unknown element 'fx:PDU-TRIGGERING'
...

The validation with xerces-j via
sax.Counter -n -np -v -s -f -hs -va
results to

[Error] FlexRay_Cluster_Example.xml:33:55: cvc-elt.1: Cannot find the
declaration of element 'fx:FIBEX'.
[Error] FlexRay_Cluster_Example.xml:40:76: cvc-elt.4.2: Cannot resolve
'flexray:CLUSTER-TYPE' to a type definition for element 'fx:CLUSTER'.
...

Because fibex4multiplatform.xsd imorts fibex4flexray.xsd and fibex.xsd,
the schemaLocation of the root element of the xml file is changed to

xsi:schemaLocation="http://www.asam.net/xml/fbx/flexray
fibex4flexray.xsd http://www.asam.net/xml/fbx fibex.xsd"

sax.Counter of xerces-j validates the xml now successful:
FlexRay_Cluster_Example.xml: 1060 ms (961 elems, 369 attrs, 0 spaces,
19497 chars)

and xerces-c is producing the same errors, and my application will be
written in c++.

Any ideas describing the mysterious behaviour of xerces?

regards

dominik holler




[1]
   http://www.asam.net/03_standards_06.php