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

查看:21
本文介绍了在 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天全站免登陆