Using XSDE with iOS and XCode 3

From Code Synthesis Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 19:27, 21 March 2012
Boris (Talk | contribs)
(Using XSDE in iPhone Applications moved to Using XSDE with iOS and XCode 3)
← Previous diff
Current revision
Boris (Talk | contribs)
(Building XSD/e runtime library for iPhone)
Line 4: Line 4:
To build the XSD/e runtime library (<code>libxsde.a</code>) and, optionally, examples, follow the instructions in the <code>INSTALL</code> file that comes with the XSD/e distribution. In particular, see the section on XCode IPhone SDK. To build the XSD/e runtime library (<code>libxsde.a</code>) and, optionally, examples, follow the instructions in the <code>INSTALL</code> file that comes with the XSD/e distribution. In particular, see the section on XCode IPhone SDK.
- 
-Note that while the instructions in the <code>INSTALL</code> file are based on XCode 3.X, they were also successfully used with XCode 4, as described in [http://codesynthesis.com/pipermail/xsde-users/2011-August/000409.html this mailing list thread]. 
== Setting up Objective-C application to use XSD/e == == Setting up Objective-C application to use XSD/e ==

Current revision

This page is a collection of notes on using XSD/e in iPhone/iPad applications written in Objective-C/Objective-C++. If you have useful information not listed on this page, please consider adding it.

Building XSD/e runtime library for iPhone

To build the XSD/e runtime library (libxsde.a) and, optionally, examples, follow the instructions in the INSTALL file that comes with the XSD/e distribution. In particular, see the section on XCode IPhone SDK.

Setting up Objective-C application to use XSD/e

To setup your iPhone application to use the XSD/e-generated code, you will need to do the following:

1. Compile your schemas to C++ with the xsde compiler. To ease the integration, use the following options to give the generated C++ files extension that are automatically recognized by the XCode IDE:

--hxx-suffix .h
--ixx-suffix .ipp
--cxx-suffix .cpp

2. Add the generated files to your project.

3. Add the .../xsde-x.y.z-i686-macosx/libxsde path to the include directory list (-I option) in your project.

4. Add the .../xsde-x.y.z-i686-macosx/libxsde/xsde path to the library directory list (-L option) in your project as well as link to libxsde.a (-lxsde). Alternatively, you can just add the absolute library path (.../xsde-x.y.z-i686-macosx/libxsde/xsde/libxsd.a) to link to.

5. Change the extension of Objective-C files that will be calling the XSD/e-generated code from .m to .mm. This will result in them being treated as Objective-C++ files that can contain a mixture of Objective-C and C++ code. For more information see Using C++ With Objective-C.

6. The .mm files can now make calls to the XSD/e-generated parsers/serializers as well as traverse the object model, as shown in the Getting Started Guides and examples.

Personal tools