I am new to xml concept. I receive data from .net web service. This web service return dataset as a result. I receive this dataset result using soap object. It returns in XML format. I could not retrieve data from the returned result.
The output for the web service is like this:
GETRESULTSResponse{GETRESULTSResult=anyType{Users=anyType{Table1=anyType{StudentID=713; RegisterNumber=2913402; StudentName=KARTHIK M; Gender=Male; CourseID=6; BranchID=27; BatchID=18; RollNumber=10SLEC603; }; }; }; }
I want to get each element data. I dont know how to parse it. Please help me out.
This is my code snippet:
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE, METHOD_NAME1);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
PropertyInfo pi = new PropertyInfo();
pi.setName("strSQL");
pi.setValue(ConstantValues.STUDENT_DETAILS);
pi.setType(ArrayList.class);
request.addProperty(pi);
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransportSE = new HttpTransportSE(SOAP_ADDRESS);
SoapObject response = null;
httpTransportSE.call(SOAP_ACTION1, envelope);
response = (SoapObject)envelope.bodyIn;
String xml = response.toString();
Document doc = XMLfunctions.XMLfromString(xml);
int numResults = XMLfunctions.numResults(doc);
if(totalCount > 0){
NodeList nodes = doc.getElementsByTagName("Table1");
for (int i = 0; i < nodes.getLength(); i++) {
Element e = (Element)nodes.item(i);
String studentId = XMLfunctions.getValue(e, "StudentID");
String regNo = XMLfunctions.getValue(e, "RegisterNumber");
String stuName = XMLfunctions.getValue(e, "StudentName");
String gender = XMLfunctions.getValue(e, "Gender");
}
}
I tried to parse data using this code. But I could not parse it. Please provide me simple method to parse xml data from soap object response which i got it from .Net webservice dataset.
Thank you in Advance.