gpt4 book ai didi

android - 在android中解析ISO8583 XML(使用android studio)

转载 作者:行者123 更新时间:2023-11-29 20:08:20 24 4
gpt4 key购买 nike

我有这个要在 android (android studio) 中解析的 XML。有人请帮忙。 AM 真的卡在这里了。

<?xml version="1.0" encoding="utf-8"?> 
<message>
<isomsg direction="response">
<field id="0" value="ew8wqq"/>
<field id="2" value="kdlaka"/>
<field id="3" value="3388382"/>
<field id="4" value="9302"/>
<field id="7" value="02061212223721"/>
<field id="11" value="9029221"/>
<field id="12" value="38383"/>
<field id="24" value="0920202"/>
<field id="32" value="Texted"/>
<field id="37" value="10031503992006830"/>
<field id="41" value="93039292"/>
<field id="49" value="uehee"/>
<field id="56" value="938339939393"/>
<field id="68" value="Test: 5001115750001"/>
<field id="102" value="5001115750001"/>
<field id="27" value="001"/>
<field id="39" value="00"/>
<field id="48" value="Successful"/>
<field id="54" value="38288928383"/>
<field id="58" value="73838383"/>
</isomsg>
</message>

我会很感激。非常感谢

请在下面找到我用来从网络服务获取响应的代码

SoapObject request = new SoapObject("http://tempuri.org/", "PostRequest");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
PropertyInfo pi = new PropertyInfo();
pi.setName("IncomingXMLMessage");

pi.setValue(GenerateXML());

request.addProperty(pi);
envelope.setOutputSoapObject(request);

HttpTransportSE httpTransportSE = new HttpTransportSE("http://10.100.10.10:9000/IWalletService.asmx");
SoapObject response = null;
httpTransportSE.debug=true;

httpTransportSE.call("http://tempuri.org/PostRequest", envelope);

response = (SoapObject)envelope.bodyIn;

int totalCount = response.getPropertyCount();
String resultString=httpTransportSE.responseDump;
Log.d("XML data ", resultString);

XmlPullParserFactory factory = XmlPullParserFactory
.newInstance();
factory.setNamespaceAware(true);
XmlPullParser parser = factory.newPullParser();

String uResultString=resultString.replaceAll("&gt;", ">");

String uResultStringFinal=uResultString.replaceAll("&lt;","<");

parser.setInput(new StringReader(uResultStringFinal));

最佳答案

为了在 Android 中解析您的 xml 数据,您显然需要为此使用解析器。谷歌建议 XmlPullParser我自己发现这真的很有用。Google 还为此提供了一些示例代码 here .在这里解释所有内容只会重复这个完全相同问题的其他答案。如果 Google 的代码还不够,您可以在网上搜索一些其他教程!

关于android - 在android中解析ISO8583 XML(使用android studio),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35345417/

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