Getting at XML data using CPURLConnection delegate

Posted by jeff.thompson on January 29th, 2009 filed in Jeff Thompson
Comment now »

I’ve been playing around with Objective-J recently, and was trying to get at the XML data from an XMLHTTPRequest through the CPURLConnection class. As it turns out the data returned in the

- (void) connection:(CPURLConnection)connection didReceiveData:(CPString)data

delegate function returns responseText rather than repsonseXML. This is easy to get around as the delegate is passing you back the CPURLConnection object used.  To get at the XML data you simply make the following call to that object:

var resp_xml = [connection _XMLHTTPRequest].responseXML;

Once you have this, you can use the usual .documentElement.* functions to work with the XML data.

Obviously, you can just grab the XMLHTTPRequest member and operate on that anyway you like as well.


test

Posted by jeff.thompson on October 22nd, 2008 filed in Jeff Massung, Jeff Thompson, Mark Allender, Market, Project Ideas, Uncategorized
4 Comments »

test