Results 1 to 6 of 6

Thread: How to parse XML in J2ME

  1. #1
    Join Date
    Feb 2010
    Posts
    154

    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.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    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.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    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 ....
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    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) (
    }

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    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.

  6. #6
    Join Date
    Jan 2008
    Posts
    1,521

    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.

Similar Threads

  1. dropdown list and parse xml!
    By bill90 in forum Software Development
    Replies: 2
    Last Post: 07-03-2012, 08:23 AM
  2. How to add parse in scanner in java?
    By MAGAR in forum Software Development
    Replies: 5
    Last Post: 02-03-2010, 04:30 PM
  3. How to Parse XML in ASP
    By Dwarner in forum Software Development
    Replies: 4
    Last Post: 24-01-2010, 04:27 AM
  4. How to Parse CSV file using PERL
    By Xena in forum Software Development
    Replies: 3
    Last Post: 31-08-2009, 10:38 AM
  5. PHP Parse error: parse error unexpected $ in main.php on line 12
    By ΘN-TH3-ЯΘCKZ in forum Software Development
    Replies: 3
    Last Post: 20-08-2009, 06:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,255,306.67849 seconds with 17 queries