Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2005

    Question XML parsing problem in Nokia 12

    Hi, guys!

    I usually use kXML library to parse XML on J2ME devices. I tried it on Nokia 12/i. In concept simulator it works fine, but when I start my IMLet on a physical device my IMLet stops without even throwing any exception. It seems to me that it stops as soon as I try to instance a class that uses kXML. I tried different versions of kXML, but the result is almost the same.

    Does anybody know if there is a specific problem with this library on Nokia 12? Are there XML parsing libraries tested on Nokia 12?

    Thank to all of you in advance!

  2. #2
    Registered User
    Join Date
    Apr 2005
    It may sound like a trivial answer, but have you checked that the appriopriate kXML classes are included in the jar file deployed to the physical device?

    I know that the parser has been working on a Nokia 12, so incompability should not be the problem.

  3. #3
    Registered User
    Join Date
    Apr 2005
    I have all necessary classes in my jar. More, in simulator it works fine. When, instead, i load my jar to Nokia 12 it runs well until the method calling these classes is invoked.
    Then the IMlet stops without throwing any exception even if my code is all inside try/catch. I'm using the last version of kXML2. What version was you know to be working?
    Here is the code for XML Dom parsing I use:

    import java.io.*;
    import org.xmlpull.v1.*;
    import org.kxml2.io.*;
    import org.kxml2.kdom.*;

    public class Test_kXML
    public static String XmlExample = "<state id-device=\"222887425013389\">"
    + "<d-io id=\"2\" type=\"O\" value=\"true\"/>"
    + "<d-io id=\"3\" type=\"O\" value=\"true\"/>"
    + "<d-io id=\"4\" type=\"O\" value=\"true\"/>"
    + "<d-io id=\"5\" type=\"O\" value=\"true\"/>" + "</state>";

    public static String Test()
    throws Exception
    String output = "";

    // New imut stream from a string
    StringReader xml = new StringReader(XmlExample);

    // creates a kXML parser from an InputStreamReader
    KXmlParser parser = new KXmlParser();
    parser.setInput (xml);
    //parser.setFeature (XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);

    // Create a document, which will hold the XML tree.
    Document doc = new Document();

    // When the call to parse exits the entire document has been
    // loaded into memory

    // Navigate
    Element root = doc.getRootElement();
    int ChildCount = root.getChildCount();
    for (int i = 0; i < ChildCount ; i++ )
    Element kid = root.getElement(i);
    if (!kid.getName().equals("address"))

    output += kid.getName() + ";";

    int SubChildCount = kid.getChildCount();

    for (int j = 0; j < SubChildCount ; j++) {}

    return output;

Posting Permissions

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