[xsd-users] How to validate XML using a in-memory schema

Raul Huertas raulh39 at tid.es
Thu Sep 28 05:46:35 EDT 2006


Hello list!

In the "C++/Tree Mapping FAQ" it is explained how to specify locations 
of schemas other than in an instance document, in order to validate 
incoming XML.

Basically, you have to:
    props.no_namespace_schema_location 
("file:///absolute/path/to/schema.xsd")

I don't feel comfortable with this way of doing things because there is 
no runtime way to verify that the file "/absolute/path/to/schema.xsd" is 
the same file that was used to generate C++ code with the xsd tool, is it?

Can I have the schema loaded in memory, in a std::string for example, 
and then use this string to validate XML?
Like:
    std::string myXsd ="<xs:schema ....>..."
    props.no_namespace_schema_location.use (myXsd);

Or, better than that, can the xsd tool save the schema in the generated 
C++ code and then use it to validate XML?

Thanks and Regards,
Raul.




More information about the xsd-users mailing list