[xsd-users] XSD generates uncompilable code

Thomas Müller th.mueller at weisang.com
Wed Mar 15 07:31:01 EST 2006


Hi,

I have some trouble with uncompilable code in MSVC++ 8.0. The type involved
uses xlink attributes and has empty content. I modified the tree/library
example to demonstrate the issue. Here are the steps:

- Change the contents of library.xsd to:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 
xmlns:xse="http://www.codesynthesis.com/xmlns/xml-schema-extension"
            xmlns:lib="http://www.codesynthesis.com/library"
            xmlns:xlink="http://www.w3.org/1999/xlink" 
            targetNamespace="http://www.codesynthesis.com/library">

  <xsd:import namespace="http://www.w3.org/1999/xlink"
schemaLocation="xlink.xsd" />

  <xsd:complexType name="test-type">
    <xsd:attribute ref="xlink:href" use="optional" />
    <xsd:attribute ref="xlink:type" fixed="simple" />
    <xsd:attribute ref="xlink:show" fixed="embed" />
    <xsd:attribute ref="xlink:actuate" fixed="onLoad" />
  </xsd:complexType>

</xsd:schema>

- Add the xlink.xsd (see attachment) to the library project (custom build:
xsd cxx-tree --generate-inline --generate-ostream --morph-anonymous
--generate-serialization xlink.xsd). 
- Generate xlink.hxx and xlink.cxx from xlink.xsd and add them to the
project (xlink.cxx compiles fine)
- Generate the code for library.xsd (no error, no warning; custom build: xsd
cxx-tree --generate-inline --generate-ostream --generate-serialization
library.xsd) and try to compile the project.

As a result I get the following errors:
1>c:\tools\xsd-2.0.0-i686-windows\examples\cxx\tree\library\library.hxx(329)
: warning C4099: 'library::test_type::type' : type name first seen using
'class' now seen using 'struct'
1>
c:\tools\xsd-2.0.0-i686-windows\examples\cxx\tree\library\library.hxx(233) :
see declaration of 'library::test_type::type'
1>c:\tools\xsd-2.0.0-i686-windows\examples\cxx\tree\library\library.hxx(339)
: error C2039: 'type_' : is not a member of 'xsd::cxx::tree::type'
1>
c:\tools\xsd-2.0.0-i686-windows\libxsd\xsd\cxx\tree\elements.hxx(110) : see
declaration of 'xsd::cxx::tree::type'
1>c:\tools\xsd-2.0.0-i686-windows\examples\cxx\tree\library\library.hxx(339)
: error C2143: syntax error : missing ';' before 'const'
1>c:\tools\xsd-2.0.0-i686-windows\examples\cxx\tree\library\library.hxx(339)
: error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\tools\xsd-2.0.0-i686-windows\examples\cxx\tree\library\library.hxx(339)
: error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\tools\xsd-2.0.0-i686-windows\examples\cxx\tree\library\library.hxx(342)
: error C2039: 'type_' : is not a member of 'xsd::cxx::tree::type'
1>
c:\tools\xsd-2.0.0-i686-windows\libxsd\xsd\cxx\tree\elements.hxx(110) : see
declaration of 'xsd::cxx::tree::type'
1>c:\tools\xsd-2.0.0-i686-windows\examples\cxx\tree\library\library.hxx(342)
: error C2143: syntax error : missing ';' before '&'
< more errors cut >

Is this a problem in XSD? Any ideas on how to work around this?

Thanks,
Thomas





-------------- next part --------------
A non-text attachment was scrubbed...
Name: xlink.xsd
Type: application/xml
Size: 1675 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20060315/48bd886e/xlink.xml


More information about the xsd-users mailing list