Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Aug 2007

    SAXParser problem in E90 and N95


    XML message that contains several same kind of the elements with different attributes causes SAXParserException atleast in E90 and N95 phones when the message is parsed with SAXParser.

    The same XML message is parsed correctly in N80 phones and S60 3rd Edition and S60 3rd Ed FP1 simulators.

    Attached midlet tries to parse first XML-message (msg1):
    <b c="0"/>
    <b c="0" d="0"/>

    and then message (msg2):

    <b c="0"/>
    <b d="0" c="0"/>

    The midlet displays for the user if the parsing succeeded or failed. Msg2 fails in E90 and N95. This causes problems when e.g. SOAP-message contains optional attributes that are inserted to the message only if they have values.

    Midlet has been tested environments in following enviroments:
    - N80 (V 3.0617.0.6 03.05.2006 RM-92 Nokia N80 (03): Midlet works correctly.
    - E90 (V 12-06-2007 RA-6 Nokia e90 2): Msg2 fails.
    - N95 (V 11.0.026 17-04-07 RM-159 Nokia N95 (03.01) ): Msg2 fails.
    - Emulator S60 3rd Edition SDK for MIDP (V S60_3_0_200552, java 1.4.2_08-b03): Midlet works correctly.
    - Emulator S60 3rd Ed. FP1 MIDP (V S60_3_1_200640 10-10-06 S60-31 S60, java 1.4.2_08-b03): Midlet works correctly.

    Is this (msg2 fails) correct behaviour and what is the correct way to go around this problem? It may not be possible to change the server implementation that is sending the XML-message to the phone.


    Kai Solehmainen


    package SaxError;

    import java.io.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.xml.parsers.*;
    import org.xml.sax.helpers.*;
    import org.xml.sax.*;

    * Midlet for demonstrating SAXParser problem.
    public class SaxErrorMidlet extends MIDlet implements CommandListener {
    private Command exitCommand;
    private Display display;
    private TextBox t = null;

    private String msg1 = "<a><b c=\"0\"/><b c=\"0\" d=\"0\"/></a>";
    private String msg2 = "<a><b c=\"0\"/><b d=\"0\" c=\"0\"/></a>";

    public SaxErrorMidlet() {
    display = Display.getDisplay(this);
    exitCommand = new Command("Exit", Command.EXIT, 2);
    t = new TextBox("", "", 256, TextField.UNEDITABLE);

    // Try to parse msg1
    try {
    tryToParse(new ByteArrayInputStream(msg1.getBytes()));
    t.setString("msg1: Parsing succeeded.");
    } catch (Exception e) {
    t.setString("msg1: Parsing failed " + e.getMessage());
    t.setString(t.getString() + "\n");

    // Try to parse msg2
    try {
    tryToParse(new ByteArrayInputStream(msg2.getBytes()));
    t.setString(t.getString() + "msg2: Parsing succeeded.");
    } catch (Exception e) {
    t.setString(t.getString() + "msg2: Parsing failed " + e.getMessage());


    public void startApp() {

    public void pauseApp() {

    public void destroyApp(boolean unconditional) {

    public void commandAction(Command c, Displayable s) {
    if (c == exitCommand) {

    private void tryToParse(InputStream is) throws Exception {
    SAXParserFactory fact = SAXParserFactory.newInstance();
    SAXParser parser = fact.newSAXParser();

    // Use default handler for testing.
    parser.parse(new InputSource(is), new DefaultHandler());
    catch (SAXParseException e) {
    throw e;
    Last edited by ksolehma; 2007-08-21 at 07:44. Reason: Moved to java forum.

  2. #2
    Super Contributor
    Join Date
    Mar 2004

    Re: SAXParser problem in E90 and N95


    You would get faster response if u posted this query to the java forum..instead of here...!!


  3. #3
    (Retired) Nokia Developer Admin.
    Join Date
    Jan 2006

    Re: SAXParser problem in E90 and N95

    new Thread in appropriate Mobile Java discussion board

    This thread is closed

Similar Threads

  1. OpenGL problem with N95 firmware
    By lenclud in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2007-08-06, 16:32
  2. N95 problem with local video file playback
    By dermicha in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2007-07-23, 17:11
  3. OCR API problem on target device N95
    By mellervin in forum Feedback - Nokia Developer Services & Infrastructure
    Replies: 10
    Last Post: 2007-06-18, 09:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts