简体   繁体   中英

How to use gSOAP to validate xml against xsd

I'm facing the following problem concerning xml validation with gSOAP:

I use wsdl2h to generate a header file from my xsd and soapcpp2 to generate C sources from that header file. Using the generated sources in my program I'm able to write an xml file.

Is there any way to validate the generated xml file against the xsd after/during generation?

Thanks, Flo

The generated XML structure will be valid according to the XSD by gsoap tooling design (data binding and serialization), but there are some cases where you will have to heed specific XSD requirements on element and attribute occurrence constraints. These are included in the generated .h file and associated with struct/class members as range information min:max. So, in that case, look for the documented occurrence constraints (minOccurs, maxOccurs, etc) in the wsdl2h-generated .h file to determine how to populate C/C++ data for XML serialization. Almost everything else is automated by the type mapping algorithm.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM