gpt4 book ai didi

java - 如何解决 ExpatParser$parseException

转载 作者:行者123 更新时间:2023-12-02 07:28:23 25 4
gpt4 key购买 nike

我从我的 .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 解析它。我关注了以下Tutorial

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

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

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

最佳答案

<?xml version="1.0"... 之前不能有空格.使用此在线应用程序查看 XML/XSD Validation

关于java - 如何解决 ExpatParser$parseException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13252019/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com