[xsd-users] Schema Validation

Boris Kolpackov boris at codesynthesis.com
Fri Oct 26 17:01:30 EDT 2007


Hi Shiva,

Balasubramanyam, Shivakumar <sbalasub at qualcomm.com> writes:

> Let's say, I have the schemas in
>
> /opt/schemas/namespace1/namespace2/schemafile1.xsd
>
> /opt/schemas/namespace1/namespace2/schemafile2.xsd
>
> And the XML document contains
> http://someurl/namespace1/namespace2/schemafile1.xsd
>
> How do I pass this information to xsd/tree parser?

Let's say schemafile1.xsd is in the http://www.example.com/namespace1
namespace and schemafile2.xsd is in http://www.example.com/namespace2.
Then you can do the following:

xml_schema::properties props;

props.schema_location (
  "http://www.example.com/namespace1",
  "file:////opt/schemas/namespace1/namespace2/schemafile1.xsd");

props.schema_location (
  "http://www.example.com/namespace2",
  "file:////opt/schemas/namespace1/namespace2/schemafile2.xsd");

root ("file.xml", 0, props);

Here 'root' is the parser function for the document root. Note
that the above schema location properties override the schema
location information specified in the XML documents.

Boris




More information about the xsd-users mailing list