Need help parsing this XML in J2ME platform

Below 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> 

I want to extract the β€œerror code” from this XML. How am I supposed to do this? Please, help.

+6
source share
2 answers

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

Once you feel confident, you can try my general approach to unmarshalling in Java ME at http://smallandadaptive.blogspot.com.br/2010/11/xml-data-binding.html

+3
source

You can use http://kxml.sourceforge.net/ to parse XML messages.

Observation

The above message looks like a Soap response message. Suppose you understand your client with soap?

+2
source

Source: https://habr.com/ru/post/911756/


All Articles