[xsde-users] error "unable to open in read mode"

Boris Kolpackov boris at codesynthesis.com
Wed Jul 27 05:40:46 EDT 2011


Hi Rashi,

Rashi Jha <rashij at cybage.com> writes:

> I  was able to generate C++ classes for the file  POCD_MT000040.xsd . But
> now when I add all the files in my project and build the project, I get 4
> errors in file POCD_MT000040-pskel.cpp  as:
> 
> 1.  error: invalid conversion from 'v3::ED*' to 'v3::thumbnail*'
> 2 . error:   initializing argument 1 of 'virtual void v3::ED_pskel::thumbnail(v3::thumbnail*)'
> 3.  error: 'class v3::cs_pskel' has no member named 'post_TimingEvent'
> 4.  error: no matching function for call to 'v3::EIVL_event_pskel::code(const v3::TimingEvent&)'

I finally got around to looking into this. First of all, I fixed a couple
of problems in XSD/e that has to do with chameleon-style inclusion (used
in your schemas). Now I am able to generate the C++ code without any
errors or seg faults and any modifications to the schemas. I can build
you a pre-release binary with these fixes if you would like (just let
me know on which platform you run the XSD/e compiler).

However, when compiling the generated code with a C++ compiler, I get
exactly the same errors as you showed above. I investigated it further
and they are all caused by complex inheritance-by-restriction use cases.
In general, inheritance-by-restriction in XML Schema does not map
cleanly to C++ inheritance and XSD/e compiler has a limited support
for this feature. A work around for this problem is to relax the
schema a little bit (if you need, you can "tighten" things back
by adding a few checks in your application or by customizing the
parser implementations and performing those checks there).

So here are the two changes I had to make to allow the generated
code to compile successfully:

1. In datatype-base.xsd in type ST line 311, change the thumbnail
   element definition from:

   <xs:element name="thumbnail" type="ED" minOccurs="0" maxOccurs="0"/>

   To:

   <xs:element name="thumbnail" type="thumbnail" minOccurs="0" maxOccurs="0"/>

2. In datatype-base.xsd in type EIVL.event line 1690, change the code
   attribute definition from:

   <xs:attribute name="code" type="TimingEvent" use="optional"/>

   To:

   <xs:attribute name="code" type="cs" use="optional"/>

Boris



More information about the xsde-users mailing list