[xsd-users] fatal error C1046: compiler limit : struct nested too
deeply
Gerard Lanois
gerard at lanois.com
Tue Apr 10 13:27:37 EDT 2007
Thanks - that was exactly what I was looking for.
The explanation you give below would make for a nice addition
to either the C++/Tree Mapping User Manual, the XSD man page
(under the description of the --morph-anonymous option) or
perhaps in the wiki. I could add it to the wiki if you could
suggest an ideal location for it.
Or maybe add this material to the C++/Tree Mapping Quick Guide.
In any case, thanks again for your help this week. I think I'm
off and running now. I've sucessfully parsed and dumped a
document using all the advice you've provided.
Cheers,
-Gerard
On 4/10/07, Boris Kolpackov <boris at codesynthesis.com> wrote:
> 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
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (GNU/Linux)
>
> iQGVAwUBRhupVciAKQuuCE8dAQJijAv+PMH/kQpAvQVcPgUWSVZe4bX1kNceakzd
> B74LGcOjWOKXujYZ5UgFnlYQFToWluPJgPKdtisjyNV6LB5ZEeuLWsbG81V5vhdC
> LR/jBIhGoiL6OgLLJK50YzvTltAgQMU/8DxGPE/W2GCKr8mJfQISgb10mvLr/ofs
> Xhjn9YqrzL5UhXeBX2DiGrR9hukep6wyXE1xt+uH4R3ArZ+qvR8JJHzHA42rJJPR
> xTbV+lpoqgMO1eLhkgGDIpTbILdSGVMOPTQpHjlLui7Qz+Pina5OeVkyr+67Htrd
> u+W3l4ypK0bjQdoAYGg2b/B6LCaXsy0QphMastN7q4LoWGI1fIqI/wnAFFPERJYv
> nau202Eu/ZSEgubXoivygwgW3alGQ8SIEP7xeYUViSP2c/cYrBlfbqpfme/mXkg1
> g0IRdDOBZ3oZsjGDchOjyRx45ofg/9pSLgXrcZ/eMq+WHei77kjV8szaRt+zG5MP
> ftLA+IccP4I4IYFS2Rz66ityD24JIbDQ
> =tEmU
> -----END PGP SIGNATURE-----
>
>
More information about the xsd-users
mailing list