[xsd-users] Problems with location-regex pathnames on Windows

Boris Kolpackov boris at codesynthesis.com
Tue Jun 10 07:04:00 EDT 2008


Hi Matthew,

Matthew.Hutchins at csiro.au <Matthew.Hutchins at csiro.au> writes:

> When I use --location-regex to map a schema name to a pathname, and the
> pathname is an absolute pathname containing a drive letter and Windows
> path separators "\", I get an error like this:
> 
> > xsd cxx-tree schema2.xsd --location-regex
> "%http://www.csiro.au/(.*)%P:\\staff\\matthew\\development\\sandbox\\xsd
> \\$1%"
> schema2.xsd: error:
> 'P:\staff\matthew\development\sandbox\xsd\schema1.xsd' is not a valid
> filesystem path
> 
> [...]
> 
> I looked at the code a bit, and it seems the job of determining whether
> a path is valid is handed to boost, and it is supposed to be checking
> for native paths, so I don't understand why there is a problem. 

Absolute/Windows paths are rarely used in include/import declarations.
The --location-regex option was meant to substitute remote URLs with
local paths, normally relative to the root schema. We didn't expect
that someone would use it for a more of an organizational purpose, not
that there is anything wrong with that.

I've fixed this problem for the upcoming release and can build you a
pre-release binary with the fix if you would like.

One drawback of using absolute paths like above is that you will end
up with the following #include directive in the generated header file:

#include "P:/staff/matthew/development/sandbox/xsd/schema1.hxx"

unless you use the --include-regex option to translate it. On the other
hand, if you used a suitable relative path in --location-regex you could
have gotten the required header #include automatically.

Boris




More information about the xsd-users mailing list