0

我从我的 dot net web 服务中得到以下结果

<?xml version="1.0" encoding="utf-8" ?> 
- <DataTable xmlns="http://www.mkttech.in/">
- <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:MainDataTable="RecordSet" msdata:UseCurrentLocale="true">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="RecordSet">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="USERNAME" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
  <xs:maxLength value="51" /> 
  </xs:restriction>
  </xs:simpleType>
  </xs:element>
  <xs:element name="PWD_EXPIRY" type="xs:int" minOccurs="0" /> 
  <xs:element name="FLDPWDMINLENGTH" type="xs:short" minOccurs="0" /> 
  <xs:element name="FLDPWDMAXLENGTH" type="xs:short" minOccurs="0" /> 
  <xs:element name="FLDMAXATTEMPT" type="xs:short" minOccurs="0" /> 
- <xs:element name="LOG_REASON" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
  <xs:maxLength value="200" /> 
  </xs:restriction>
  </xs:simpleType>
  </xs:element>
- <xs:element name="EXCH_SEG" msdata:ReadOnly="true" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
  <xs:maxLength value="51" /> 
  </xs:restriction>
  </xs:simpleType>
  </xs:element>
- <xs:element name="SEGMENTDESC" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
  <xs:maxLength value="100" /> 
  </xs:restriction>
  </xs:simpleType>
  </xs:element>
- <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
- <DocumentElement xmlns="">
- <RecordSet diffgr:id="RecordSet1" msdata:rowOrder="0">
  <USERNAME /> 
  <PWD_EXPIRY>0</PWD_EXPIRY> 
  <FLDPWDMINLENGTH>2</FLDPWDMINLENGTH> 
  <FLDPWDMAXLENGTH>8</FLDPWDMAXLENGTH> 
  <FLDMAXATTEMPT>100</FLDMAXATTEMPT> 
  <LOG_REASON>INVALID PASSWORD...</LOG_REASON> 
  <EXCH_SEG>NSE-CAPITAL</EXCH_SEG> 
  <SEGMENTDESC>NSE Capital Market</SEGMENTDESC> 
  </RecordSet>
  </DocumentElement>
  </diffgr:diffgram>
  </DataTable>

我正在使用 SoapObject 来接收此响应。接下来我使用 xmlpullparser 解析它。我按照以下 教程

但是执行 nextTag() 时出现以下异常

org.xmlpull.v1.XmlPullParserException:解析文档时出错。(位置:第 -1 行,第 -1 列)由以下原因引起:org.apache.harmony.xml.ExpatParser$ParseException:第 1 行第 7 列:格式不正确(无效令牌)

我对android和java都是新手。我真的需要帮助。提前致谢!

4

1 回答 1

2

之前不应该有空格<?xml version="1.0"...。检查这个在线应用程序进行XML/XSD 验证

于 2012-11-06T13:30:21.037 回答