Using XSDE with iOS and XCode 3
From Code Synthesis Wiki
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.