How to link libxml2 in Xcode for use with TouchXML?
- Copy TouchXML files. They are wrappers to libxml2.
- Instead of copying an extra copy of libxml2 to the project frameworks, add the following to the target information:
Header Search Paths:
/usr/include/libxml2
Other Linker Flags: -lxml2
(Of course assuming, that libxml2 is present at this location on your system.)
In the Target Info, make sure to select the current configuration to see the values. Otherwise you get <Multiple Values> and they look like it's not possible to edit them. Took me a while to figure out, that changing the configuration [top left] was the key. Duh.
NSXMLParser parses XML, reports when each node ends, better for very, very large documents.
libxml2 loads whole xml file into memory.
http://code.google.com/p/touchcode/wiki/TouchXML
http://code.google.com/p/kissxml/
iPhone SDK Development by Bill Dudney and Chris Adamson
NSXMLParser
initWithContentsOfURL: may block GUI while downloading, can not handle HTTP authentication.
initWithData: accumulate data with NSURLConnection's delegate -didReceiveResponse, -didReceiveData, -connectionDidFinishLoading.
TouchXML
- copy TouchXML files to project
- in "Targets", select target > Get Info > add /usr/include/libxml2 to Header Search Paths
- add libxml2.dylib to "Frameworks"
UPDATE
instead of adding libxml2.dylib link to the Framework on the system:
Other Linker Flags:
-lxml2
Linking libxml2 in Xcode