[xsd-users] search path for the xsd include files.

Balasubramanyam, Shivakumar sbalasub at qualcomm.com
Wed Sep 12 03:51:12 EDT 2007


Boris,

Appreciate your quick and detailed response.

This is what we follow and was wondering if we were doing it right.
Thanks for the confirmation.

Thanks,
Shiva

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Wednesday, September 12, 2007 12:41 AM
To: Balasubramanyam, Shivakumar
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] search path for the xsd include files.

Hi Shiva,

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

> ROOTDIR/
>   Dir1/a.xsd
>   Dir2/b.xsd
>
> b.xsd imports Dir1/a.xsd.
>
>
> What is the suggested way to have the import statement as and how do
we
> tell code synthesis when generating the code from b.xsd to find a.xsd
in
> ROOTDIR/Dir1.

The import statement would have the path as "../Dir1/a.xsd". Unless the
path is a full URI, XML Schema processors treat it as relative to the
schema document which contains the import/include statement.


> Basically, I am looking to see if I can provide a list of include
paths.

We were thinking about this and it would be trivial to implement in XSD,
but decided against it for the following reason: the XML files may be
referencing the schemas and in that case there won't be any way to
specify extra search paths. Even if we added support for this in the
generated code, such XML documents would be unusable with other
validating XML parsers.

Note also that there is a number of ways to change the generated
C++ header include paths using the --include-prefix, --include-regex,
and --include-with-brackets options (see the man pages for details).
For example, the above import statement by default will be translated
to the following #include directive:

#include "../Dir1/a.hxx"

If you would like to change it to "Dir1/a.hxx" (and add -IROOTDIR to
your C++ compiler command line) then you can use the following option:

--include-regex '%../(.+)%$1%'

Boris




More information about the xsd-users mailing list