Sending and receiving XML, to and from server using Cocoa

前端 未结 1 913
说谎
说谎 2020-12-21 19:47

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 documen

相关标签:
1条回答
  • 2020-12-21 20:14

    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.

    0 讨论(0)
提交回复
热议问题