asp.net的后台,直接返回了datatable,内容如下:<?xml version="1.0" encoding="UTF-8"?>
-<DataTable xmlns="http://tempuri.org/">
-<xs:schema xmlns="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="NewDataSet">
-<xs:element msdata:UseCurrentLocale="true" msdata:MainDataTable="Table" msdata:IsDataSet="true" name="NewDataSet">
-<xs:complexType> -<xs:choice maxOccurs="unbounded" minOccurs="0">
-<xs:element name="Table">
-<xs:complexType>
-<xs:sequence>
<xs:element name="ArtiId" minOccurs="0" type="xs:int"/>
<xs:element name="ArtiBarCode" minOccurs="0" type="xs:string"/>
<xs:element name="ArtiClassCode" minOccurs="0" type="xs:string"/> <xs:element name="ArtiCode" minOccurs="0" type="xs:string"/>
<xs:element name="ArtiName" minOccurs="0" type="xs:string"/>
<xs:element name="ArtiSpec" minOccurs="0" type="xs:string"/>
<xs:element name="ArtiUnit" minOccurs="0" type="xs:string"/>
<xs:element name="RetailPrice" minOccurs="0" type="xs:decimal"/>
<xs:element name="CostPrice" minOccurs="0" type="xs:decimal"/>
<xs:element name="Validity" minOccurs="0" type="xs:short"/>
<xs:element name="ArtiProcAddr" minOccurs="0" type="xs:string"/>
<xs:element name="UseStatus" minOccurs="0" type="xs:short"/>
<xs:element name="ModifyDate" minOccurs="0" type="xs:dateTime"/>
<xs:element name="OpenDate" minOccurs="0" type="xs:dateTime"/> </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">
<ArtiId>959687</ArtiId>
<ArtiBarCode>6941856101586 </ArtiBarCode>
<ArtiClassCode>0223040201</ArtiClassCode>
<ArtiCode>50959687 </ArtiCode>
<ArtiName>½ð轸߽îÌؾ«·Û2.5kg </ArtiName>
<ArtiSpec>2.5kg </ArtiSpec>
<ArtiUnit>´ü </ArtiUnit>
<RetailPrice>12.9</RetailPrice>
<CostPrice>9.159292</CostPrice>
<Validity>180</Validity>
<ArtiProcAddr>ºÓÄÏ </ArtiProcAddr>
<UseStatus>0</UseStatus>
<ModifyDate>2012-12-11T00:12:33.913+08:00</ModifyDate>
<OpenDate>2012-08-22T10:38:51.563+08:00</OpenDate>
</Table>
</NewDataSet>
</diffgr:diffgram>
</DataTable>
andro Code如下: if(envelope.getResponse() != null){
SoapObject result2 =(SoapObject)envelope.getResponse();
String strTv2="获得数组:";
for(int i=0;i<result2.getPropertyCount();i++)
{
SoapObject soapChilds =(SoapObject)result2.getProperty(i);
strTv2 +=soapChilds.getProperty("ArtiCode").toString();
}
以上代码获得此错误“illegal property: ArtiCode”;SoapObject result2 =(SoapObject)envelope.getResponse();result2从服务器返回数据如下:
目的是在strTv2中循环获得节点字符,然后显示在TextView中,但是我的结果如上图。求教各位高手,如何获得此XML中的数据,求助!!!感激
-<DataTable xmlns="http://tempuri.org/">
-<xs:schema xmlns="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="NewDataSet">
-<xs:element msdata:UseCurrentLocale="true" msdata:MainDataTable="Table" msdata:IsDataSet="true" name="NewDataSet">
-<xs:complexType> -<xs:choice maxOccurs="unbounded" minOccurs="0">
-<xs:element name="Table">
-<xs:complexType>
-<xs:sequence>
<xs:element name="ArtiId" minOccurs="0" type="xs:int"/>
<xs:element name="ArtiBarCode" minOccurs="0" type="xs:string"/>
<xs:element name="ArtiClassCode" minOccurs="0" type="xs:string"/> <xs:element name="ArtiCode" minOccurs="0" type="xs:string"/>
<xs:element name="ArtiName" minOccurs="0" type="xs:string"/>
<xs:element name="ArtiSpec" minOccurs="0" type="xs:string"/>
<xs:element name="ArtiUnit" minOccurs="0" type="xs:string"/>
<xs:element name="RetailPrice" minOccurs="0" type="xs:decimal"/>
<xs:element name="CostPrice" minOccurs="0" type="xs:decimal"/>
<xs:element name="Validity" minOccurs="0" type="xs:short"/>
<xs:element name="ArtiProcAddr" minOccurs="0" type="xs:string"/>
<xs:element name="UseStatus" minOccurs="0" type="xs:short"/>
<xs:element name="ModifyDate" minOccurs="0" type="xs:dateTime"/>
<xs:element name="OpenDate" minOccurs="0" type="xs:dateTime"/> </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">
<ArtiId>959687</ArtiId>
<ArtiBarCode>6941856101586 </ArtiBarCode>
<ArtiClassCode>0223040201</ArtiClassCode>
<ArtiCode>50959687 </ArtiCode>
<ArtiName>½ð轸߽îÌؾ«·Û2.5kg </ArtiName>
<ArtiSpec>2.5kg </ArtiSpec>
<ArtiUnit>´ü </ArtiUnit>
<RetailPrice>12.9</RetailPrice>
<CostPrice>9.159292</CostPrice>
<Validity>180</Validity>
<ArtiProcAddr>ºÓÄÏ </ArtiProcAddr>
<UseStatus>0</UseStatus>
<ModifyDate>2012-12-11T00:12:33.913+08:00</ModifyDate>
<OpenDate>2012-08-22T10:38:51.563+08:00</OpenDate>
</Table>
</NewDataSet>
</diffgr:diffgram>
</DataTable>
andro Code如下: if(envelope.getResponse() != null){
SoapObject result2 =(SoapObject)envelope.getResponse();
String strTv2="获得数组:";
for(int i=0;i<result2.getPropertyCount();i++)
{
SoapObject soapChilds =(SoapObject)result2.getProperty(i);
strTv2 +=soapChilds.getProperty("ArtiCode").toString();
}
以上代码获得此错误“illegal property: ArtiCode”;SoapObject result2 =(SoapObject)envelope.getResponse();result2从服务器返回数据如下:
目的是在strTv2中循环获得节点字符,然后显示在TextView中,但是我的结果如上图。求教各位高手,如何获得此XML中的数据,求助!!!感激
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货