急!我如何在android手机端解析webservice返回的dataset数据啊?急用。在线等待。有用功的吗
<?xml version="1.0" encoding="utf-8" ?>
- <DataSet xmlns="http:// tempuri. org/">
- <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http:// www .w3. org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:Locale="">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="Table">
- <xs:complexType>
- <xs:sequence>
<xs:element name="ID" type="xs:int" minOccurs="0" />
<xs:element name="Code" type="xs:string" minOccurs="0" />
<xs:element name="Title" type="xs:string" minOccurs="0" />
<xs:element name="Law" type="xs:string" minOccurs="0" />
<xs:element name="LawCatalog" type="xs:string" minOccurs="0" />
<xs:element name="Content" type="xs:string" minOccurs="0" />
<xs:element name="OrderIndex" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
- <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
- <NewDataSet xmlns="">
- <Table diffgr:id="Table1" msdata:rowOrder="0">
<ID>1</ID>
<Code>lawitem001</Code>
<Title>第一条</Title>
<Law>law001</Law>
<LawCatalog>law001</LawCatalog>
<Content>为了加强城市市容和环境卫生管理,创造清洁、优美的城市工作、生活环境,促进城市社会主义物质文明和精神文明建设,制定本条例。</Content>
<OrderIndex>1</OrderIndex>
</Table>
- <Table diffgr:id="Table2" msdata:rowOrder="1">
<ID>2</ID>
<Code>lawitem002</Code>
<Title>第二条</Title>
<Law>law001</Law>
<LawCatalog>law001</LawCatalog>
<Content>在中华人民共和国城市内,一切单位和个人都必须遵守本条例。</Content>
<OrderIndex>2</OrderIndex>
</Table>
- <Table diffgr:id="Table3" msdata:rowOrder="2">
<ID>3</ID>
<Code>lawitem003</Code>
<Title>第三条</Title>
<Law>law001</Law>
<LawCatalog>law001</LawCatalog>
<Content>城市市容和环境卫生工作,实行统一领导、分区负责、专业人员管理与群众管理相结合的原则。</Content>
<OrderIndex>3</OrderIndex>
</Table>
</NewDataSet>
</diffgr:diffgram>
</DataSet>
格式是这样的。谢谢了 有什么办法啊
detail = (SoapObject) result.getProperty("getStationNameResult");
if (detail.getName()=="anyType")
{
for (int i = 0; i < detail.getPropertyCount(); i++) {
SoapObject sopObject = (SoapObject) detail.getProperty(i);
strName = sopObject.getProperty(0).toString();
strCode = sopObject.getProperty(1).toString();
currentStation = new Station();
currentStation.setStationName(strName);
currentStation.setStationShort(strCode);
listStations.add(currentStation);
}
}
if (envelope.getResponse() != null) {
SoapObject soapObject = (SoapObject) envelope.bodyIn;
for (int i = 0; i < soapObject.getPropertyCount(); i++) {
SoapObject soap1 = (SoapObject) soapObject.getProperty(i);
for (int j = 0; j < soap1.getPropertyCount(); j++) {
System.out.println(soap1.getProperty(j).toString())
}
}
}
根据xml 的格式,多遍历几次就出来了