[xsd-users] Issue using proxy for Open Packaging Conventions core-properties schema

Boris Kolpackov boris at codesynthesis.com
Mon Jun 24 08:14:08 EDT 2013


Hi Rob,

Rob Ursem <Rob.Ursem at cmgl.ca> writes:

>   <xs:complexType name="W3CDTF">
>    <xs:simpleContent>
>     <xs:restriction base="dc:SimpleLiteral">
>         <xs:simpleType>
>            <xs:union memberTypes="xs:gYear xs:gYearMonth xs:date xs:dateTime"/>
>         </xs:simpleType>
>         <xs:attribute ref="xml:lang" use="prohibited"/>
>     </xs:restriction>
>    </xs:simpleContent>
>   </xs:complexType>
>
> [...]
>
> 1. The initialization of types is somehow skipped by the compiler for types
>    that have not been referenced before. If I don't include line 5 above,
>    the "dcterm:W3CDTF type is not registered and my parsing (on line 8)
>    fails. This seems to be an issue with the compiler (VS2012) rather than
>    with XSD.

Are you by any chance packaging the generated code into a static library
(.lib)? If so, then this post explains why it won't work out of the box:

http://www.codesynthesis.com/pipermail/odb-users/2013-May/001286.html

And this followup explains how to make it work with VS:

http://www.codesynthesis.com/pipermail/odb-users/2013-May/001289.html


> 2. Once the document is parsed I get a 'created_optional' type (which makes
>    sense). From there on I can get to a dcterms::W3CDTF type (line 13) but I
>    have not been able to get the date value out of that element.

The W3CDTF type is defined as a union of a whole bunch of other types.
XSD maps uinons to strings and you will have to figure out which member
it it and extract the data yourself. One way to do it would be to
customize the generated type.

Boris



More information about the xsd-users mailing list