[xsd-users] ifc xml
boris at codesynthesis.com
Thu Jan 27 04:22:43 EST 2011
giuseppe ferrari <giuseppe500 at yahoo.it> writes:
> The reason for this error is the use of the nillable attributes in
> the schema. XSD does not yet support this feature so when it sees
> an element like this in the XML document:
> <IfcOrganization xsi:nil="true" ref="i1556"/>
> It expects to find the required content of this element (like child
> element 'Name').
> Can you try the above options and see if you get the same error?
> In the meantime, I will think of any workarounds for this problem
> (I can't think of anything good right now).
Ok, I have come up with a workaround. As I mentioned above, XSD does
not support nillable elements. This is actually one of those misguided
XML Schema features that don't map cleanly to OO models and that hardly
anyone uses (in XML Schema nil elements can still have attributes). The
idea behind my workaround is to customize the types that are used in
nillable elements and handle the nil semantics there. Since there are
a lot of such types in your schema, we use a template wrapper (see the
nillable-type.hxx file for details).
All the necessary options files as well as nillable-type.hxx are
available in this archive:
The README file inside provides the XSD command lines that I used to
compile the schemas. With this approach I was able to parse the file
without any errors and cast to the ifc:uos element.
More information about the xsd-users