Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , , ,

Sponsored Links



How to parse XML in J2ME

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 19-02-2010
Member
 
Join Date: Feb 2010
Posts: 146
How to parse XML in J2ME

Hi all,

XML has been widely used in the field of data exchange, xml is based on plain text, with excellent cross-platform features. I want how to parse XML in J2ME for data transmission. Please suggest. Thanks in advance.
Reply With Quote
  #2  
Old 19-02-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,976
How to parse XML in J2ME

Before the use of XML, you must consider the good and not have to use it to transmit data, because xml parsing is more resource-intensive, especially in the CPU and memory resources are precious conditions. If we can use DataInputStream and DataOutputStream, then transfer to try not to use XML. XML parser, there are two, one is sure of, he would have xml parsing of the document prior to the effectiveness of verification, to ensure that it is the application needed. Check and reply.
Reply With Quote
  #3  
Old 19-02-2010
Member
 
Join Date: May 2008
Posts: 1,990
How to parse XML in J2ME

Written in XML is relatively simple and very easy to people to read. But it must be the client and server-side XML parser can have a normal communication, because of the initial mobile information device memory and processor on the lack of, so MIDP1.0 did not provide XML support.You can use kxml. To use the kxml, you must first get a XmlParser instance, it uses Reader as the constructor parameters. Check that and reply.
Code:
try (
Reader r123 = .....;
XmlParser parser = new XmlParser (r123);
}
catch (java.io.IOException e) (
/ / Handle exception ....
}
Reply With Quote
  #4  
Old 19-02-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,976
How to parse XML in J2ME

If you want to use nanoxml for parsing XML in J2ME, then you must first create an kXMLElement instance, and then call parseFromReader, parseString or parseCharArray. Because it is the first step parser, then it will parse the entire document exhausted generate an Object tree. Each node is a kXMLElement instance, by calling getChildren methods such as navigation in this tree.
Code:
HttpConnection conn123 = ....;
InputStreamReader doc123 =
new InputStreamReader (conn.openInputStream ());
kXMLElement root123 = new kXMLElement ();

try (
root.parseFromReader (doc123);
}
catch (kXMLParseException pe) (
}
catch (IOException ie) (
}
Reply With Quote
  #5  
Old 19-02-2010
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 2,267
How to parse XML in J2ME

With the improvement of memory and processors of XML support as possible. JSR182 is provided in the XML parser, but this is not the standard MIDP in the API require a specific implementation can support. Fortunately, there is a third-party API provides support for parsing xml to compare well-known is the kxml and nanoxml. You can download this parser from website. Best of luck.
Reply With Quote
  #6  
Old 19-02-2010
Modifier's Avatar
Member
 
Join Date: Jan 2008
Posts: 1,502
Re: How to parse XML in J2ME

The other parser is non-confirmation in nature, They does not do validation work directly parsing, no doubt such a speed would be faster. kxml and parser nanoxml are like this. They are also differences, kxml incremental parser that he will bit by bit resolution, so that when parsing large documents will be more efficient. nanoxml parser is the first step, once put the document parsing finished, if the document is very large, it will undoubtedly cost a great memory. Check and reply.
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to parse XML in J2ME"
Thread Thread Starter Forum Replies Last Post
How to add parse in scanner in java? MAGAR Software Development 5 02-03-2010 04:30 PM
How to Parse XML in ASP Dwarner Software Development 4 24-01-2010 04:27 AM
How to parse msExchRecordedName? Kartik Subbarao Active Directory 1 03-12-2009 01:01 AM
How to Parse CSV file using PERL Xena Software Development 3 31-08-2009 11:38 AM
PHP Parse error: parse error unexpected $ in main.php on line 12 ΘN-TH3-ЯΘCKZ Software Development 3 20-08-2009 07:07 PM


All times are GMT +5.5. The time now is 11:34 AM.