[xsd-users] Error report for XSD-4.0

alexander.gosling at kongsberg.com alexander.gosling at kongsberg.com
Mon Aug 25 10:57:35 EDT 2014


Hello Boris,
Some clarifications:

1.
I did not mean that this is an error in your code. It is just that it is not robust to what happens in user code it is included into.
In our case msxml.h gets included into our code for a reason I am not able to find within 30 minutes of work.
By not prefix DOMDocument by its namespace in the XSD code it causes an ambiguity between msxml::DOMDocument and xercesc::DOMDocument.
I think it is a good practice to always prefix types with their namespace in API include files as you can not know what context it is included into.
I do not see why DOMDocument should not be prefixed by its namespace in serialization.txx especially since it is already done for other xercesc types in the same file in several places already.

2.
Yes, there are --include-regex expressions in options files.
They look like this (Result produced by searching all files):
  E:\Work\jsmoms\Jade\JadeOpenGIS\res\JadeOpenGIS\JadeOpenGIS-include.opts (4 hits)
        Line 2: --include-regex %.*/schemas/(.+)%Jade/OpenGIS/$1%
        Line 3: --include-regex %.*Common/(.+)%Jade/OpenGIS/Common/$1%
        Line 15: # --include-regex %.*xml-mod.h%Jade/OpenGIS/gml/3.1.1/smil/xml-mod.h%
        Line 17: --include-regex %.*xml-mod.h%Jade/OpenGIS/xml/xml.h%
  E:\Work\jsmoms\Jade\JadeWxS\cpp\src\JadeWxS-WPS\JadeWxS-WPS.opts (1 hits)
        Line 21: --include-regex %.*ExecuteResponses.h%Jade/WxS/WPS/1.0.0/ExecuteResponses.h%

I have used some time working around other build issues not concerned with XSD to be sure of my previous conclusion.
The conclusion is that given the exact same command line and options files, version 3.3.0 of xsd.exe produces correct include statement while version 4.0 of xsd.exe produces wrong result. The problem may as you suggest be in different handling of --include-regex


3.
We have managed to strip down the SW tree to a manageable example supplied in the attached zip file.
- A script file with the command to run xsd.exe is at the top of the tree called generate.bat.
- The source file atom.xsd file
- Several other source directories referenced in mapping commands.
- Several options files
- The script assumes that the root of this file tree is at E:/. If you install it elsewhere you must modify the script.
- The resulting files are atom.h and atom.cpp in the folder E:\TestXsdKda\jsmoms_RelWithDebInfo\Jade\JadeOpenGIS\include\Jade\OpenGIS\atom\1.0
- There are cpp and h files there to compare against. They have suffix 4.0AtKda

--
alex


-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com]
Sent: 15. august 2014 10:17
To: Gosling, Alexander
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] Error report for XSD-4.0

Hi Alexander,

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

> 1. libxsd\xsd\cxx\tree\serialization.txx does not compile in our environment.
> I had to change line 104 from
>           DOMDocument& doc (*e.getOwnerDocument ()); to
>           ::xercesc::DOMDocument& doc (*e.getOwnerDocument ()); which
> I suppose is exactly the same declaration, only a little bit more
> specific.

That's very strange. We have tested 4.0.0 with VC 2012 and this code was definitely compiled without any errors. Could you open the 'library'
example and try to build it, to see if you get the same error?


> 2. For a number of schemas from opengis.org, the include statement to
>    xml.h is wrong in the generated code
>
> The include statement generated with 4.0 is:
>         #include
> <Jade/OpenGIS/regrep/3.0/e:\work\jsmoms\jade\jadeopengis\schemas\xml\x
> ml.h>
> while generated with 3.3.0 it is:
>         #include <Jade/OpenGIS/xml/xml.h>
>
> The generation is done with exactly the same command line.

I just tried your example and both XSD 4.0.0 and XSD 3.3.0 generate the same #include for this command line:

xsd cxx-tree --location-map http://www.w3.org/2001/xml.xsd=/tmp/xml.xsd --output-dir /tmp rim.xsd

I.e., they both have '#include "/tmp/xml.hxx"'.

My guess is that you have some --include-regex options (perhaps in the .options files not shown?) that translate such paths and that don't work the same in XSD 4.0.0 for some reason. If you have such options and can show them, then I could take a look.

Boris

________________________________

CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be proprietary, confidential or subject to export regulations, and is only meant for the intended recipient(s). Any disclosure, copying, distribution or use is prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in error, please delete it immediately from your system and notify the sender properly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestXsdKda.zip
Type: application/x-zip-compressed
Size: 1445956 bytes
Desc: TestXsdKda.zip
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20140825/98e89063/TestXsdKda-0001.bin


More information about the xsd-users mailing list