在J2ME平台中解析此XML时需要一些帮助 [英] Need some help in parsing this XML in J2ME platform

查看:71
本文介绍了在J2ME平台中解析此XML时需要一些帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面提到的是我的XML,

Below mentioned is my XML,

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelopexmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<Response xmlns="http://tempuri.org/">
<Result>
    <mp_response>
        <data signature="something">
                  <outcome errorcode="0" errordescription="" errorsolution=""/>
                 something
</data>
</mp_response>
</Result>
</Response>
</soap:Body>
</soap:Envelope>

我希望从此XML中提取错误代码". 我应该怎么做? 请帮忙.

I wish to extract the "errorcode" from this XML. How I am suppose to do that ? Please help.

推荐答案

如果目标设备支持JSR 172中的SAX,则应使用此解析器.它将减小应用程序的最终jar大小(不导入任何库).在 http://www.developer.nokia.com/Community中有一个很好的示例/Wiki/JSR_172:_XML_Parsing_Example 实际上将XML解组为Java对象.

确信之后,您可以在 http://smallandadaptive.blogspot.com.br/2010/11/xml-data-binding.html

If your target devices support SAX from JSR 172, you should go with this parser. It will reduce your app's final jar size (no libs imported). There is a good sample at http://www.developer.nokia.com/Community/Wiki/JSR_172:_XML_Parsing_Example It actually unmarshalls the XML into Java objects.

After you feel confident you may try my generic approach to unmarshalling in Java ME at http://smallandadaptive.blogspot.com.br/2010/11/xml-data-binding.html

这篇关于在J2ME平台中解析此XML时需要一些帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆