[xsd-users] Schema Validation

Balasubramanyam, Shivakumar sbalasub at qualcomm.com
Thu Dec 13 20:12:49 EST 2007


Boris,

I used the alternative you mentioned in the email and available in test
program (examples/xsd/tree/caching), which works great so far.

The XSD's have the namespaces and also I have to specify only the
physical location to the schema file.

However, I am curious why Code Synthesis is not supporting this scheme.

For instance, in Code Synthesis, if I use schemaLocation in schemas,
then I could not find a way to validate without specifying the mapping
of namespaces to physical schema files.

Am I missing something?

Thanks,
Shiva
-----Original Message-----
From: xsd-users-bounces at codesynthesis.com
[mailto:xsd-users-bounces at codesynthesis.com] On Behalf Of
Balasubramanyam, Shivakumar
Sent: Thursday, December 13, 2007 1:56 PM
To: Boris Kolpackov
Cc: xsd-users at codesynthesis.com
Subject: RE: [xsd-users] Schema Validation

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