using libxml2 on the iPhone

I am trying to work with an xml file on the iPhone. It looks like the best way is to use libxml2.

The sample application "SeismicXML" uses libxml2 without problems. however I cannot seem to import libxml2 into my own project.

I am currently including libxml2 by clicking Action->Add->Existing Frameworks and selecting /Developer/Platforms/Aspen.platform/Developer/SDKs/Aspen1.2.sdk/usr/lib/libxml2 .2.dylib.

When I add an #import <libxml/xmlmemory.h> statement in my header file it gives an error saying there is no such file or directory.

Is there something else I have to do in order to use libxml2.

Thank you in advance for any help I have been struggling with this issue for the past day.

Mac OS X (10.5.2)

Posted on Mar 14, 2008 6:37 PM

Reply
9 replies

Mar 15, 2008 2:45 PM in response to William_D

Thank you very much William_D.

My project now compiles perfectly. It is kinda frustrating because I had gone through all the build settings of SeismicXML to get them to match my own and I did not see any differences. Even now when I go back to the SeismicXML project and look at the 'Header Search Paths' option I see it does not have anything.

Oh well, adding the 'Header Search Path' that you suggested works and now I can continue programming, thanks again and marked as solved.

Mar 16, 2008 3:17 PM in response to Lazy Eye

I encountered the same issue and was able to fix by adding the header path.

I also noticed that SeismicXML does not have this setting.

The only difference I was able to see is that SeismicXML has this for Base SDK:
/Developer/Platforms/Aspen.platform/Developer/SDKs/Aspen1.2.sdk

and new projects have this set to
Device - Aspen 1.2

Couldn't figure out why the difference or how to change it, but adding header path worked.

Nov 8, 2008 5:37 PM in response to Lazy Eye

HELP... I can't get libxml in my iphone project. I read the posts , and followed the instructions but it didn't work. I must be doing something very stupid... This is what I did (in XCODE it says Simulator|Debug in the Overview)

1. click on Action->Add->Existing Frameworks
2. I see a lib directory and I then highlight libxml2.2.dylib and click ADD
3. A window pops up with Reference Type: Default and Text Encoding: Unicode (UTF-8) There are 3 other items that are NOT clicked (copy items into destination,recursively create groups, create folder reference)
4.I click ADD and the libxml2.2.dylib appears in the Frameworks folder
5. I click project-> Edit Project Settings
6. On the Header Search Paths line I click on the empty value and enter
/usr/include/libxml2/
7. In one of my files I add
#include <libxml/xmlreader.h>


HELP! It doesn't work I keep getting "no such file or directory"

Nov 8, 2008 6:04 PM in response to binjaja

Scratch that last cry for help.. I figured out I that I was changing the wrong build file. When I selected Project->Edit Project Settings , it brought up Project "MyProjectName" Info file and when I filled in Header Search Paths it did nothing. I reread the post which said to right click on the Target->GetInfo which brings up the Target "MyProjectName" Info file. By changing the Header Search Paths in that file , I got my project to compile. Whats the difference between the two? I figure one is for debug, one for release or something like that. Can anyone point me to documentation explaining what they are for?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

using libxml2 on the iPhone

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.