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

Rob Ursem Rob.Ursem at cmgl.ca
Mon Jun 24 13:39:30 EDT 2013


Boris,

Thanks for that first link. I had found the /OPT:NOREF but the flag I was missing was the "Use library dependency Inputs: YES". That solved my first problem

As for the W3CDTF W3CDTF is a SimpleLiteral type which is a _type. Neither W3CDTF nor SimpleLiteral provide access to the text representation of the element as W3CDTF contains no variables or attributes and SimpleLiteral only contains the (optional) lang attribute. 

There are accessors on _type for _node() which would get me to _node()->getTextContent() but the issue is that _node() returns a nullptr for my W3CDTF instance.
I noticed LiquidXML generated code that contained a text element for W3CDTF so I could get it from that node directly but I don't see an equivalent in the XSD generated code. 
Perhaps there is an option that allows me to get the raw text for the element so I could provide my own interpretation. It seems counter to the philosophy of the library but is that what you meant with "customize the generated type"? 

I can see I can modify the generated code but I would rather not since there is the option to re-generate it. I haven't tried deriving off the generated code since generally the rest of the generated code does not instantiate or use the derived code.

Rob

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Monday, June 24, 2013 6:14 AM
To: Rob Ursem
Cc: xsd-users at codesynthesis.com
Subject: Re: [xsd-users] Issue using proxy for Open Packaging Conventions core-properties schema

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