[xsd-users] fatal error C1046: compiler limit : struct nested too deeply

Boris Kolpackov boris at codesynthesis.com
Tue Apr 10 11:12:21 EDT 2007


Hi Gerard,

Gerard Lanois <gerard at lanois.com> writes:

> When I use --morph-anonymous, I find that the standard
> idiom for parsing a document does not compile:
>
>    std::auto_ptr<BLAH::type> blah(BLAH(argv[1]));
>
> [...]
>
> It seems that --morph-anonymous prevents the usual
> "public: typedef _xsd_BLAH_::BLAH type;" from being
> generated in class BLAH.

When you use the --morph-anonymous option, all anonymous types become
explicitly named. As a result, the generated code can change. In case
of a global element with anonymous type:


<element name="foo">
  <complexType>
    ...
  </complexType>
</element>

The transformation performed by the --morph-anonymous option results
in the following equivalent schema (this is performed internally by
the compiler):

<complexType name="foo">
  ...
</complexType>

<element name="foo" type="foo"/>

And the generated code now looks like this:

class foo
{
  ...
};

std::auto_ptr<foo> foo_ (const char* url);


Note that the name of the parsing functions is escaped with '_' to avoid
name clashes. The usage becomes:

std::auto_ptr<foo> f = foo_ ("foo.xml");


hth,
-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/20070410/3bbd369b/attachment.pgp


More information about the xsd-users mailing list