×

Discussion Board

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

    Question SAXParser problem in E90 and N95

    Hello,

    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):
    <a>
    <b c="0"/>
    <b c="0" d="0"/>
    </a>

    and then message (msg2):

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

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

    BR

    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);
    t.addCommand(exitCommand);

    // Try to parse msg1
    try {
    tryToParse(new ByteArrayInputStream(msg1.getBytes()));
    t.setString("msg1: Parsing succeeded.");
    } catch (Exception e) {
    e.printStackTrace();
    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) {
    e.printStackTrace();
    t.setString(t.getString() + "msg2: Parsing failed " + e.getMessage());
    }

    t.setCommandListener(this);
    }

    public void startApp() {
    display.setCurrent(t);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void commandAction(Command c, Displayable s) {
    if (c == exitCommand) {
    destroyApp(false);
    notifyDestroyed();
    }
    }

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

    // Use default handler for testing.
    try{
    parser.parse(new InputSource(is), new DefaultHandler());
    }
    catch (SAXParseException e) {
    throw e;
    }
    }
    }

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    17

    Re: SAXParser problem in E90 and N95

    I'm the same problem in N95 (new firmware).
    Have you found a solution ?

    Bye Roberto

Similar Threads

  1. SAXParser problem in E90 and N95
    By ksolehma in forum Series 40 & S60 Platform Feedback Archive
    Replies: 2
    Last Post: 2007-08-23, 15:38
  2. OpenGL problem with N95 firmware 12.0.0.13?
    By lenclud in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2007-08-06, 16:32
  3. 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

Posting Permissions

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