[xsd-users] Schema Validation

Balasubramanyam, Shivakumar sbalasub at qualcomm.com
Thu Dec 13 16:55:31 EST 2007


Boris,

The use case below worked as long as I have only one schema file that
had a unique namespace.

In our case, we have multiple schemas which has same target namespace.

How do we solve this case? When I tried, I think it overwrote the
mapping information. 

It is possible to register multiple schema files for same namespace?

Thanks,
Shiva

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Friday, October 26, 2007 2:02 PM
To: Balasubramanyam, Shivakumar
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] Schema Validation

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