开发者

parsing the response from xml

开发者 https://www.devze.com 2023-03-16 10:42 出处:网络
I am new to webservices and I want to parse this xml and store the response(String val) in a local variable. how can I do this? plz some one post the code snippet for th开发者_高级运维is.

I am new to webservices and I want to parse this xml and store the response(String val) in a local variable. how can I do this? plz some one post the code snippet for th开发者_高级运维is.

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
  Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
      <RegisterUserResponse xmlns="http://tempuri.org/">
     <RegisterUserResult>string</RegisterUserResult>
      </RegisterUserResponse>
    </soap:Body>
   </soap:Envelope>


There are many parsing technique available in Android itself: XmlPullParser, DOM Parser and SAXParser. You can implement any.

Here are the best examples to learn about XML Parsing: http://www.ibm.com/developerworks/library/x-android/

Otherwise, you should try to Google with this link: http://bit.ly/j1j12x


You can Use SAX, DOM or pull parser. Follow the links for tutorial

http://www.androidpeople.com/android-xml-parsing-tutorial-using-saxparser

http://www.androidpeople.com/android-xml-parsing-tutorial-%E2%80%93-using-domparser

http://www.tutorialforandroid.com/2009/05/how-to-use-xmlpullparser-in-android.html


You should be able to get anything you need surrounding Android in the Google Documentation. Here's a link:

http://developer.android.com/training/basics/network-ops/xml.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号