[xsd-users] Error report for XSD-4.0

Boris Kolpackov boris at codesynthesis.com
Tue Sep 2 06:33:42 EDT 2014


Hi Alexander,

[I've CC'ed xsd-users to my reply since other might run into a similar
 issue.]

alexander.gosling at kongsberg.com <alexander.gosling at kongsberg.com> writes:

> We have done some testing on different version of XSD and on different 
> platforms.
> 
> On Windows it is only in XSD version 4.0 it fails. It is correct for
> version 3.3.0.
> 
> On Linux it works on both versions: 4.0 and 3.3.0.
> 
> For us it seems that there must be something wrong/strange with the 
> xsd.exe version 4.0 for Windows.

Ok, I've figured out what the problem is. Starting with 4.0.0, XSD now
always uses canonical paths on each platform. That is, on POSIX it
will be /foo/bar while on Windows it will be c:\foo\bar. Specifically,
on Windows the path will always use back-slashes (\) even if you 
specified (some) of them using forward slashes.

So the first change that I've made to your options file is to match
both kind of slashes:

--include-regex %.*[\\/]schemas[\\/](.+)%Jade/OpenGIS/$1%
--include-regex %.*Common[\\/](.+)%Jade/OpenGIS/Common/$1%

This only fixed the problem partially. Now the include directive
looks like this (note the wrong last slash):

#include <Jade/OpenGIS/xml\xml.h>

Unfortunately there is no elegant way to fix this last slash other
than by splitting the path into components and then re-assembling
it with the correct slashes. I checked and in your case you can
have maximum there components after schemas/ so we need three
options (note that the order is important):

--include-regex %.*[\\/]schemas[\\/](.+)%Jade/OpenGIS/$1%                                                                                                 
--include-regex %.*[\\/]schemas[\\/](.+)[\\/](.+)%Jade/OpenGIS/$1/$2%                                                                                     
--include-regex %.*[\\/]schemas[\\/](.+)[\\/](.+)[\\/](.+)%Jade/OpenGIS/$1/$2/$3%                                                                         
--include-regex %.*Common[\\/](.+)%Jade/OpenGIS/Common/$1%

With this fix I get the correct include directive:

#include <Jade/OpenGIS/xml/xml.h>

Boris



More information about the xsd-users mailing list