I make connection with my webservices (SOAP) this the xml result that I recieved from the webservices how can I parse this result without SAX parser...
<maintag>
<item>
<name>AndroidPeople</name>
<website category="android">www.androidpeople.com</website>
</item>
<item>
<name>iPhoneAppDeveloper</name>
<website category="iPhone">www.iphone-app-developer.com</website>
</item>
</maintag>
EDIT:/ I was wondering to parse this result with Kxmlparser, can anybody tell me how?
Many thanks!
SOAP FILE
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = (TextView)findViewById(R.id.TextView01);
// Maak een nieuw Soap Request object en parameter
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("GUID","4fe78-a4s4df8-65a4sd-465as4a");
request.addProperty("InstallVersion","1");
// Soapenvelope versie van webservice
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.encodingStyle = SoapSerializationEnvelope.XSD;
envelope.setOutputSoapObject(request);
// Transport gegevens vanaf URL
HttpTransportSE aht = new HttpTransportSE(URL);
try
{
aht.call(SOAP_ACTION, envelope);
SoapPrimitive resultsString = (SoapPrimitive)envelope.getResponse();
tv.setText("Result :" + resultsString);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
Java has a built in XML parser. You can see a sample of a recent file I made to do this here: https://github.com/LeifAndersen/NetCatch/blob/master/src/net/leifandersen/mobile/android/netcatch/services/RSSService.java (it's at the bottom of the page)
Here are the three method's you'll be mostly interested in: