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

Rashi Jha rashij at cybage.com
Thu Jul 28 10:37:27 EDT 2011


Hi  Boris,

I have made certain  improvements in getting the driver compile & build at my end. 
I tried to follow the below steps for getting my driver class code run successfully  :

1. Added generated C++ files for hello sample to my project.
2. Added libxsde.a  library to my libraries.
3. Provided path to the libxsde folder in the header search paths option under Build tab.

When I built the project in XCode(IDE), it ran successfully and printed the output in debugger as:

[Session started at 2011-07-28 19:41:04 +0530.]
In Driver Main 
Hello, sun!
Hello, moon!
Hello, world!
 
But when I try to get the same output through terminal via below command, it gives me output as below:

# Mac-mini:Build rashij$ ./Debug-iphonesimulator/HelloCodeSynthesis.app/HelloCodeSynthesis ./Debug-iphonesimulator/HelloCodeSynthesis.app/hello.xml 

 dyld: Library not loaded: /System/Library/Frameworks/UIKit.framework/UIKit
  Referenced from: /Users/rashij/HelloCodeSynthesis/Build/./Debug-iphonesimulator/HelloCodeSynthesis.app/HelloCodeSynthesis
  Reason: image not found
Trace/BPT trap
Mac-mini:Build rashij$  


 Problem in my XSD generated C++ files:  When trying to create the driver.cxx file for my schema, I found that the parser aggregate classes were not being generated in implementation file.

 While, the aggregate class is getting generated for hello.xsd's  hello-pimpl.h generated file.  Will you please let me know if the parser aggregate class in the implementation file

 is getting  generated at your end?  I am not able to find as to why are the aggregate classes not getting generated for my XSD's global elements.

Looking forward to your reply.

Regards
Rashi





-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Wednesday, July 27, 2011 3:11 PM
To: Rashi Jha
Cc: xsde-users at codesynthesis.com; Amit Jain
Subject: Re: [xsde-users] error "unable to open in read mode"

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


"Legal Disclaimer: This electronic message and all contents contain information from Cybage Software Private Limited which may be privileged, confidential, or otherwise protected from disclosure. The information is intended to be for the addressee(s) only. If you are not an addressee, any disclosure, copy, distribution, or use of the contents of this message is strictly prohibited. If you have received this electronic message in error please notify the sender by reply e-mail to and destroy the original message and all copies. Cybage has taken every reasonable precaution to minimize the risk of malicious content in the mail, but is not liable for any damage you may sustain as a result of any malicious content in this e-mail. You should carry out your own malicious content checks before opening the e-mail or attachment." 
www.cybage.com





More information about the xsde-users mailing list