TouchXML installation guide

TouchXML is a libxml API wrapper written in Objective-C and usually helps with all your project XML needs. While writing my post about parsing XML element attributes and putting up demo project I realized that I tend to forget how to add TouchXML to new project, so here goes step-by-step of that procedure:

1. Get TouchXML

You can find archives to download in touchcode project downloads . Go to TouchCode github page and download TouchXML archive and extract it anywhere you like. It’s common practice to keep such libraries and classes in Developer/ExtraLibs directory.

2. Enable libxml2 library

First things first, before we actually add TouchXML files, we need to do some project configuration changes, so our project could use libxml library.

1. Go to “Project -> Edit project settings”

2. Activate “Build” tab

3. Search for “Header search paths” setting and add /usr/include/libxml2 value to it

libxml header search paths

4. Search for “Other linker flags” setting and add -lxml2 value

touchxml other linker flags

P.s. notice that search function is really useful for finding settings you need faster.

3. Add TouchXML classes

1. Right click (option click) on your projects “Classes” folder and go to “Add -> Existing files…”

2. Navigate to the directory where extracted TouchXML is kept and browse  deeper to “Common -> Source”. Select everything! And click “Add” obviously.

touchxml classes

3. Confirm.

Now you should see a bunch of new files in your project. I usually group them by selecting files I wish to group and then selecting “Group” in context (right click/option click) menu.

4. Import TouchXML to your project

#import "TouchXML.h"

That is all the “magic” and you’re good to go. Since, I am not going to write about actually using TouchXML, you can see a nice working example in my previous post.

5. Common errors

Error: libxml/tree.h: No such file or directory

… and hundreds of something missing errors. It means that something went wrong with “Header search paths”. Maybe you didn’t added /usr/include/libxml2
or added incorrectly? Check it.

Error: “_xmlDocDumpFormatMemory”, referenced from:- [CXMLDocument description] in CXMLDocument.o

… and tens of errors like this. While errors by them selfs aren’t very expressive, they wish to inform you, that you did not added -lxml2 flag to “Other linker flags”

And that is all for now!

Tags: , ,

67 responses

  1. sathya
    Posted April 28, 2010 at 11:47 | Permalink

    Hi, i got this error,

    “Error: libxml/tree.h: No such file or directory ” with 356 errors,

    even after correctly added /usr/include/libxml2 to “Header search paths”. what to do?

  2. sathya
    Posted April 28, 2010 at 11:51 | Permalink

    hi, i follow everything above , but i got “Error: libxml/tree.h: No such file or directory” with 356 errors.help me.

  3. Key
    Posted May 6, 2010 at 03:44 | Permalink

    I got the same problem too, but i found a solution is that…..
    Please check your Configuration (Release / Debug) in Project Settings
    It is damn shit that default is release mode …. but you compile in debug mode

  4. Bill
    Posted May 17, 2010 at 06:25 | Permalink

    Another possible solution for those having trouble:

    instead of going to “Project -> Edit project settings” try making the changes in “Project -> Edit active target ” instead.

    And do pay attention to the Configuration setting in the upper-left of the settings window. Change it to “All Configurations”.

  5. masch
    Posted June 14, 2010 at 11:25 | Permalink

    It works very well except for one warning: CXMLDocument.m:229: warning: no ‘-_XMLStringWithOptions:appendingToString:’ method found

  6. zenwheel
    Posted June 15, 2010 at 06:00 | Permalink

    @masch – I just changed line 229 to be: [xmlString appendString:[root XMLStringWithOptions:options]];

  7. Martijn
    Posted July 14, 2010 at 23:04 | Permalink

    And how do you install libxml2 if you don’t got it?

  8. Joel
    Posted August 18, 2010 at 19:50 | Permalink

    If you still get the libxml/tree.h errors you probably have devices specified under library search paths, like I had device and simulator (you may have one or the other). If you modify the library search path above these, it has no effect. You have to add it for each of these line items.

    Also build->clean

  9. Sean Langley
    Posted August 20, 2010 at 13:12 | Permalink

    I ran into the libxml/tree.h errors issue, and solved it for me. Remember that if you have multiple targets in your Xcode project, that you need to edit the configurations for all targets. For instance, I’ve got an App target, and a Tests target. I needed to add the /usr/include/libxml2 to the Header Search paths for “All configurations” in both of the targets.

  10. andi aja
    Posted September 7, 2010 at 15:07 | Permalink

    you need to add libxml2 framework into the project too

  11. kiran
    Posted November 13, 2010 at 06:48 | Permalink

    HI…

    great job you down…..

    I configure but i got 24 errors in my application…..
    _xmlDocSetRootElement
    XmlNodeListGetString
    xmlAddChild
    xmlNewText…
    xmlXPathFreeContext…
    xmlReadMemory
    xmlDocGetRootElement…….
    ……..
    xmlFree

  12. Tristan
    Posted January 14, 2011 at 14:29 | Permalink

    Great guide, good job!

  13. Robert
    Posted January 25, 2011 at 01:20 | Permalink

    Hi,

    I have an error with TouchXML, Opening and Ending tag mismatch at the start of the CXMLDocument, and I haven’t even tried to parse it I, was just loading the data into the document and it crashed,

  14. Pramod Jain
    Posted February 23, 2011 at 08:21 | Permalink

    @Robert, did you find any solution for validating the xml content (Opening and Ending tag mismatch) using TouchXML . Please share..

  15. Posted February 25, 2011 at 11:03 | Permalink

    archive missing

  16. Posted April 2, 2011 at 01:19 | Permalink

    Both solitary cell phone number listed in the United States includes a full profile while features; names, age anthology, address, along with sexual category info.

  17. Mike S.
    Posted April 6, 2011 at 19:37 | Permalink

    The URL for the download isn’t working – looks like it needs updated to the new site. I was able to dig around and find a depreciated version of TouchXML for use.

  18. Posted April 26, 2011 at 14:12 | Permalink

    pleasant post, i certainly love this url, proceed it

  19. Arun
    Posted May 11, 2011 at 11:16 | Permalink

    Everything is ok . What about the target .

  20. Posted May 17, 2011 at 18:01 | Permalink

    Superb post, not often can I read such magnificance. Do you have any forums with similar content?

  21. suresh kumar
    Posted June 30, 2011 at 13:45 | Permalink

    it works good well.thank u for given that one

  22. itai
    Posted July 11, 2011 at 16:04 | Permalink

    i am getting tons of errors like that: “ARC forbids explicit message send to ‘autorelease’” and “autolrelease is unavailable…” – any ideas? does this API supports xcode 4.2?

    • SD
      Posted September 25, 2011 at 13:08 | Permalink

      @itai Please disable ARC in latest Xcode

  23. alexz
    Posted August 8, 2011 at 17:00 | Permalink

    Hi, I’m getting the same: “ARC forbids explicit message send to ‘autorelease’” issue. What should we do?

    • SD
      Posted September 25, 2011 at 13:08 | Permalink

      @alexz @itai Please disable ARC in latest Xcode

      • LFMDK
        Posted January 18, 2012 at 11:07 | Permalink

        any chance to create a ARC enabled version?

  24. Posted August 10, 2011 at 10:16 | Permalink

    My iOS app was just rejected by Apple for “using undocumented APIs.” They determined this based on the presence of a function called “elementWithName.” Quick search of my code yields this function name inside TouchXML. (1) Wow, F you Apple. (2) Perhaps you should change the name of the function? I will offer a patch on Github.

  25. Posted September 30, 2011 at 23:42 | Permalink

    Works like a charm! Cheers for this.

  26. Posted October 14, 2011 at 02:45 | Permalink

    Hi my app is crashing in iOS5
    one of the error is this
    CXMLDocument.m
    function: initWithXMLString
    EXC_BAD_ACCESS

    Did anyone have the same issue ?
    is there an update to touchXML to work with iOS5 ?
    Thanks

  27. xinliang
    Posted November 28, 2011 at 12:52 | Permalink

    very great post

    Thanks for your introducing with TouchXML

  28. Amir
    Posted January 2, 2012 at 20:04 | Permalink

    How to parser XSD schema using Touch XML API

    129
    Station 1
    Station 1

    128
    Station 2
    Station 2

    NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
    @"http://www.example.ae/",
    @"tempuriSatellite",
    nil];

    // Set the resultNodes Array to contain an object for every instance of an node in our XSD feed
    //resultNodes = [rssParser nodesForXPath:@"//GetStationsResult" error:nil];

    resultNodes = [rssParser nodesForXPath:@"//tempuriSatellite:Stations" namespaceMappings:dict error:nil]

  29. Posted January 7, 2012 at 06:46 | Permalink

    So, that’s how you add TouchXML to new project? I really don’t have much idea about these technical stuff but fortunately, you have posted images which made the process easier to understand and follow. Thanks! Will you be posting more guides like these? I’ll be looking forward to it.

  30. Vijay
    Posted January 26, 2012 at 22:02 | Permalink

    Awesome article

  31. Posted March 7, 2012 at 07:22 | Permalink

    well

  32. Posted March 12, 2012 at 14:48 | Permalink

    Whenever you find yourself on the side of the majority, it is time to pause and reflect.
    It isn’t whatever you pay a man, but what he costs you that counts.

  33. Posted April 20, 2012 at 17:42 | Permalink

    zenwheel, wouldn’t that mean that XMLStringWithOptions would have infinite recursion? Not so sure that is a good solution… Why isn’t _XMLStringWithOptions defined? I see it is commented out in CXMLElement.m

  34. hayden
    Posted July 7, 2012 at 10:45 | Permalink

    i request my webservice url by asihttp and i get response of data in string format and i want to parse this xml string using touch xml so plz provide me touch xml example any url you have?

  35. Posted March 2, 2013 at 17:25 | Permalink

    Hello there, You’ve performed a great job. I will certainly digg it and personally recommend to my friends. I am confident they will be benefited from this site.

  36. Posted April 9, 2013 at 17:39 | Permalink

    Working…

  37. Alannah Kranewitter
    Posted May 19, 2013 at 00:05 | Permalink

    I am curious to find out what blog system you have been working with? I’m having some small security problems with my latest blog and I’d like to find something more safeguarded. Do you have any solutions?Orange Roofing Contractors, 1010 N. Batavia St., #F2, Orange, CA 92867 – (714) 770-8684

  38. Posted July 7, 2013 at 19:24 | Permalink

    I do not even understand how I ended up here, however I
    believed this post used to be good. I don’t realize who you might be however certainly you’re going to a famous blogger when you aren’t already. Cheers!

  39. Posted July 16, 2013 at 01:19 | Permalink

    Excellent, what a weblog it is! This blog presents helpful information
    to us, keep it up.

    Look at my blog post – lose weight fast for men

  40. Posted July 20, 2013 at 18:41 | Permalink

    Wow that was unusual. I just wrote an incredibly long comment but
    after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing
    all that over again. Anyways, just wanted to say superb blog!

  41. Posted July 27, 2013 at 12:52 | Permalink

    Hi there, just become alert to your blog via Google, and located that it is really informative. I’m gonna be careful for brussels. I’ll be grateful should you proceed this in future. A lot of other people can be benefited out of your writing. Cheers!

  42. Posted July 29, 2013 at 11:31 | Permalink

    I have been surfing online greater than 3 hours lately, yet I by no means discovered any interesting article like yours. It’s lovely worth sufficient for me. Personally, if all webmasters and bloggers made just right content material as you did, the web shall be much more helpful than ever before.

  43. Posted December 10, 2013 at 15:43 | Permalink

    Sweet blog! I found it while browsing on Yahoo News.
    Do you have any suggestions on how to get listed
    in Yahoo News? I’ve been trying for a while but I never seem to get there!

    Cheers

  44. Posted February 12, 2014 at 18:26 | Permalink

    But planning a vacation in Gatwick and looking for aI would like you
    to suggest Elite chauffeur cars. Smaller scaled cars were sold alone in its alternative
    fueled first three days of release, delivers plenty of opportunities for making money from your passion.
    automobiles for sale by owner

  45. Posted March 18, 2014 at 04:38 | Permalink

    May Almighty hospitals 60657 God come to our aid.
    The union budget 2012 can act in both ways.

    Where does hospitals 60657 the money go? If you live near Marconi & Watt Avenues and want groceries, there
    is good reason to go here is this: you are not aiming at any niche market.
    Of course, tomorrow could always bring a contradictory report,
    and the Middle East and North Africa, are now running substantial deficits.

    Feel free to surf to my web page; Doctor’s Clinic Poulsbo

  46. Posted April 4, 2014 at 14:18 | Permalink

    Mini Ninjas uses a lot of beautiful and simple artwork.
    Other than that particular heart thumping track though, everything else just seems fitting to certain scenes, but nothing really pops as far as a
    catchy tune, or inspiring. At the same time, you can come across a number of picturesque
    locations like the natural landscapes in the form of forest, ocean and water, which makes the game simply awesome.

  47. Posted April 16, 2014 at 02:07 | Permalink

    If you resolve to make any transform into your platform registry you can encounter a
    new surprise – “Windows cannot find. By causing something interesting, it can support dismiss the negative emotions and considerations within. Some of these companies can unlock the cell telephone remotely also.

Leave a Reply