[xsd-users] #include directives & relative paths

Boris Kolpackov boris at codesynthesis.com
Wed Dec 13 03:10:34 EST 2006


Hi David,

Long time, no see ;-)


Moss, David R (SELEX Comms) (UK Christchurch) <david.r.moss at selex-comm.com> writes:

> --+ root
>     + base
>       + schema
>           basic-types.xsd
>       + generated
>           basic-types.hxx
>
>     + derived
>       + schema
>           derived-types.xsd
>       + generated
>           derived-types.hxx
>
>
> [...]
>
> I have this problem:
>
> The #include directive in derived-types.hxx is
>
> #include <../../root/schema/basic-types.hxx>
>
> Which doesn't exist. I'd like to not have to specify the relative path
> of the base schema on the import line and instead use just the file name
> with the
>
> --include-prefix "generated"
>
> command to produce an include directive
>
> #include <generated/sentinel-user-config.hxx>
>
> which will build since my build environment finds it in the path.

Hm, right now --include-prefix is just added to the full path from
the schema include statement:

#include <generated/../../root/schema/basic-types.hxx>

One way to address this would be to have an option to strip the directory
part from the path before applying --include-prefix, so that we end up with

#include <generated/basic-types.hxx>

The problems with this solution are as follows:

1. It will strip the directory part from all paths. It is quite possible
   one may want to keep it in some #include's and strip it in others.

2. What if one wants to strip only a part of the directory. For example
   what if you wanted your #include directive to be relative to root:

   #include <base/generated/basic-types.hxx>

So it seems to me like a full-blown regex replacement mechanism is in
order here. It will address both of the above problems and will allow
one to implement non-trivial transformations on the include paths.
What do you think?


thanks,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20061213/5ed157a4/attachment.pgp


More information about the xsd-users mailing list