I am currently testing how to combine ios, php, mysql and xml. So far I have set up a database, got my php scripts working and am using them to request data from my external mysql database that then returns the results to my app using ASIHTTPRequest network wrappers.. what I am now trying to do is parse the xml that I am generating with my php scripts, Its a pretty easy example my php looks a little something like this
<?xml version="1.0"?>
<entries>
<code>3237554</code>
</entries>
All I am looking to parse is that number, In the past I have use NSXMLParse from the objective-c library however I was calling everythi开发者_JAVA百科ng from an rss feed so the set up to acquiring the data was entirely different as it was not self generated etc. Due to the fact that I am using ASIHTTPRequest I am taking a guess here 'that I would hopefully like you to help me with' is that I should be grabbing my xml in
- (void)requestFinished:(ASIHTTPRequest *)request
which is pretty obvious because I am grabbing just basic text output from there as it is now.. So my question is what is the best way to start parsing this text thats coming in? is there a special xml parser library I am not aware of or can I use NSXMLParser some how?
//EDIT:: Working solution here
If the size of the returned xml is not that big, libxml2 is a nice convenient solution that I have used effectively.
Take a look at Matt's blog here --
http://cocoawithlove.com/2008/10/using-libxml2-for-parsing-and-xpath.html
精彩评论