tags:

views:

31

answers:

1

I have some XML data that I want to transmit to a web server and the response is also in XML.

I am trying to use Cocoa to parse the XML. I have followed this document to create the XML and transmit it, but the document doesn't explain very well how you can receive the XML response from the server.

I haven't been able to find any good examples using google either. Can someone point me to some good resources to integrate XML and Cocoa? Thanks

+1  A: 

The article that you posted looks pretty comprehensive. Did you implement the three connection delegate methods? Once you execute transmitXMLRequest:, the NSURLConnection object will automatically start loading in data. Your delegate will see the following:

connection:didReceiveResponse:
connection:didReceiveData:
connection:didReceiveData:
connection:didReceiveData:
...
connectionDidFinishLoading:

The code that you place in each of those delegate methods is critical. Without it, no data is ever retreived from the server.

In your article, on page 3, it describes how to create an NSXMLDocument from the received data. NSXMLDocument simplifies the process of parsing an XML file. For details, see Apple's Tree-Based XML Programming Guide.

e.James
I figured out adding the XML, but am stuck at another phase now. I guess i'll post another question for it. Thanks.