How to use assertions with Xerces C ++ 3.x (CodeSynthesis XSD)?

I just read this tutorial on XSD 1.1 assertions:

http://www.ibm.com/developerworks/library/x-xml11pt2/

I copied one of my examples and created this file xsd

:

<?xml version="1.1"?>                                                               
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">                             
<xs:element name="dimension">                                                    
  <xs:complexType>                                                               
    <xs:attribute name="height" type="xs:int"/>                                  
    <xs:attribute name="width" type="xs:int"/>                                   
    <xs:assert test="@height = @width"/>                                         
  </xs:complexType>                                                              
</xs:element>                                                                    

</xs:schema>                                                                     

      

I am trying to parse this code into hxx code using CodeSynthesis XSD XML Schema for C ++ 4.0.0 compiler using the following command

/ path / to / binary cxx-tree / path / to / file.xsd

but I am getting the following error:

/path/to/file.xsd:7:41: error: invalid element 'assert' in complex typedef

I am getting the same error when I change the xml version to 1.0

. As I understand it, the xml version shouldn't matter in this case, but I could be wrong.

What can cause this error message and how can I fix it?

+3


source to share


1 answer


Your XSD is using assertions correctly. (You probably want version="1.0"

XML in your declaration as this is the XML version, not the XSD version, but that is not the source of the error.)

Your XSD processor does not support XSD 1.1 if it rejects your XSD.



Refresh . Indeed, according to the CodeSynthesis website , CodeSynthesis XSD 4.0.0 is based on Xerces-C ++ which does not support XSD 1.1. CodeSynthesis really needs to make this explicit on their product page.

+4


source







All Articles