[xsd-users] AnyType and the extraction of contents

Boris Kolpackov boris at codesynthesis.com
Wed May 13 06:36:34 EDT 2020


Daniel Kåsa <daniel.kaasa at gmail.com> writes:

> The schema type which I am using is from the following
> http://schemas.opengis.net/om/2.0/observation.xsd.

Ok, assuming there is no xsi:type in the XML document, that element is
a non-polymorphic anyType.


> If I drop "--generate-polymorphic" then anyType is initialized with the
> "flags:extract_contents" and I have no longer an issue.

Besides --generate-polymorphic you should also have one or more of the
--polymorphic-type* options and one of them (such as --polymorphic-type-all)
forces treating anyType as polymorphic. You can try to "tighten" these
options to only treat types that are truly polymorphic as such (of course,
it's possible that somewhere else in your schema anyType is used as a
polymorphic base in which case this workaround won't work).


> Can we assume that these two modes may not be used simultaneously then?

I think it's safe to say this is a bug. As described above, anyType can
be used both ways in the same vocabulary and the generated code should
be smart enough to handle it.



More information about the xsd-users mailing list