Kxml vs kxml2 vs wbxml4j

Hi, All
Could you explain differences between kxml and kxml2 java libs? The main question - what versions of oma dm supports kxml2 wbxml parcer ? Only 1.2 or previous too ?
Also, what is better - wbxml4j or kxml or kxml2 ? What opensource stuff can I use, what to have best support of wbxml transformations ?
Thanks in advance.

Similar Messages

  • Problem parsing xml in J2ME (using kxml2)

    Hello.
    May someone who knows how to use kxml help me please?
    I'll try to be straight forward. (Please excuse my imperfect English)
    My xml file look something like this:
    <?xml version="1.0" encoding="utf-8"?>
    <sample_tag1 xmlns:mysample="http://www.sample001.com/sample01schema">
    <feature name=”tag1_feature”>
         <test name=”xxxxx” id=”200” message=”Hello.”></test>
    </feature>
    <catalog name="shelf">
         <booklist name="book1" label="b1"></booklist>
         <booklist name="book2" label="b2"></booklist>
         <booklist name="book3" label="b3"></booklist>
    </catalog>
    </sample_tag1>
    And here's my code
              //http request
                   try{
                   //I can guarantee that the URL is valid
    httpConnection = (HttpConnection) Connector.open(URL);
    }catch(IOException ioe){
    ioe.printStackTrace();
                   //Create the parser
    KXmlParser parser = new KXmlParser();
    try{
                        //I use this code section to test if the xml file is properly placed in the inputStream.
    char[] tempChar = new char[500];
    isr = new InputStreamReader(httpConnection.openInputStream());
    isr.read(tempChar);
    for(int i=0; i<tempChar.length;i++){
    System.out.print(tempChar);
    //set the xml input
    parser.setInput(isr);
    //skip the "<?xml version="1.0" encoding="utf-8"?>" tag
    parser.nextTag();
    parser.require(XmlPullParser.START_TAG, null, "sample_tag1");
                        System.out.println("name : " + parser.getName());
    System.out.println("namespace : " + parser.getNamespace());
    parser.nextTag(); // ***1
    I compiled the app and run, here's the result:
    name : sample_tag1
    namespace :
    org.xmlpull.v1.XmlPullParserException: attr value delimiter missing! (position:START_TAG <feature name='http://www.sample001.com/sample01schema'>@3:15 in java.io.InputStreamReader@e938beb1)
    at org.kxml2.io.KXmlParser.exception(+47)
    at org.kxml2.io.KXmlParser.error(+45)
    at org.kxml2.io.KXmlParser.parseStartTag(+285)
    at org.kxml2.io.KXmlParser.nextImpl(+314)
    at org.kxml2.io.KXmlParser.next(+23)
    at org.kxml2.io.KXmlParser.nextTag(+24)
    at MyMidlet$ReadXML.run(MyMidlet.java:235)
    But when I comment the last line (parser.nextTag(); // ***1), here's the result:
    name : sample_tag1
    namespace :
    My code is the clone of the one in this tutorial:
    http://www.developer.com/ws/article.php/3759471
    where he get the weather forecast from Yahoo Weather RSS
    What did I do wrong? I tried looking up google for "attr value delimiter missing!" but found no useful information.
    Thank you in advance. =)

    Please read this topic. I posted an answer about parsing xml using kxml2
    http://forums.sun.com/thread.jspa?threadID=5291592&start=0&tstart=0
    Regards,
    David

  • Problems with kXMLParser (kXML 2)

    Hi colleagues,
    when I run my MIDlet which parses an XML file with the kXMLParser (kXML 2) I get the following exception:
    org.xmlpull.v1.XmlPullParserException: PI must not start with xml (position:unknown ���@1:7 in java.io.InputStreamReader@d590dbc)
         at org.kxml2.io.KXmlParser.exception(+47)
         at org.kxml2.io.KXmlParser.error(+42)
         at org.kxml2.io.KXmlParser.parseLegacy(+149)
         at org.kxml2.io.KXmlParser.nextImpl(+365)
         at org.kxml2.io.KXmlParser.next(+23)
         at org.kxml2.io.KXmlParser.nextTag(+4)
         at com.zesium.HelpParser.parse(+26)
         at com.zesium.HelpParser.openFile(+65)
         at com.zesium.HelpParser.run(+12)
    I don't understand what I did wrong. I serached for an explanation in the internet but I did not find anything.
    My XML file has the following structure:
    <?xml version="1.0" encoding="UTF-8" ?>
    <items>
    <item name="Funktionen">
    <paragraph>Text1</paragraph>
    </item>
    <item name="Programmbedienung">
    <paragraph>Text2</paragraph>
    <paragraph>Text3</paragraph>
    </item>
    </items>
    And my code is:
    public class HelpParser extends Thread {
    public void run() {
    openFile();
    public void openFile() {
         String helpResource = ResourceManager.getResourceString("help.file");
         InputStream in = this.getClass().getResourceAsStream("/res/"+helpResource);
         this.parse(in);
    public void parse(InputStream in) {
         // Initialize XML parser
         Reader reader = new InputStreamReader(in);
         KXmlParser kxmlParser = new KXmlParser();
         try {
              kxmlParser.setInput(reader);
              kxmlParser.nextTag();
              kxmlParser.require(XmlPullParser.START_TAG, null, "items");
              while (kxmlParser.nextTag() != XmlPullParser.END_TAG) {
                   readXMLData(kxmlParser);
              kxmlParser.require(XmlPullParser.END_TAG, null, "items");
              kxmlParser.next();
              kxmlParser.require(XmlPullParser.END_DOCUMENT, null, null);
         catch (XmlPullParserException xmlppe) {
              xmlppe.printStackTrace();
         catch (IOException ioe) {
              ioe.printStackTrace();
    private void readXMLData(KXmlParser parser) throws IOException, XmlPullParserException {
         String name = null;
         String paragraph = null;
         //Parse the element "item" in the XML file
         parser.require(XmlPullParser.START_TAG, null, "item");
         name = parser.getAttributeValue(null, "name");
         while (parser.nextTag() == XmlPullParser.START_TAG) {
              parser.require(XmlPullParser.START_TAG, null, "paragraph");
              paragraph = parser.nextText();
              parser.require(XmlPullParser.END_TAG, null, "paragraph");
         // Just for testing
         System.out.println("name: "+name);
         System.out.println("paragraph: "+paragraph);
    }     

    unlike johnson's c++ xml parser implementation, kxml is known to have problems with non-normalized xml tag patterns. kxml works like a charm with normalized structures. to solve the problem, we simply preprocess the byte stream to make it normalized -- by removing the rogue elements. however, avoid using stringbuffer in such kxml operations because it makes memory very volatile (you can see this in the sun mobility memory monitor). similar to QualComm's Brew operating system, the virtual machine does not do a stand-up job with garbage collection while using kxml. you should use GC whenever it is appropriate within the kxml parser code blocks.

  • KXML Error

    Hello i need some help here, i dont know what to do anymore. I'm using eclise and i'm trying to run my KXML Parser and i'm getting this error:
    Running with storage root C:\Documents and Settings\daniel\j2mewtk\2.5.2\appdb\DefaultColorPhone
    Running with locale: Portuguese_Brazil.1252
    Running in the identified_third_party security domain
    java.lang.NoClassDefFoundError: org/xmlpull/v1/XmlPullParserException
         at br.furb.furbot.mobile.MundoVisual.iniciarSequencia(+0)
         at br.furb.furbot.mobile.MundoVisual.iniciarSequencia(+6)
         at br.furb.furbot.mobile.exercicios.Teste.startApp(+37)
    I added the kxml jar on build path, what should i do to resolve this problem? The problem ocours when i run as a Java ME Midlet...

    SOLVED...
    Step 1:
    Eclipse -> "Project Properties" -> Java Build Path -> Add Jar (search .jar da KXML).
    Step 2: (Important!!!)
    On "build path" screen, go to the tab "_Order and Export_" , check the lib kxml2-xxxx.jar ,So now eclipse can see the .class files when Running as Middlet on the Emulator.
    Ty all
    Cya

  • Using kxml2 to write xmls

    hi everybody i wanna read and write xmls in movile application, somebody here told me to use kxml, i downloaded kxml2 but there is no documentation about how to write xml just how to read, any link you could provide me? pleaseeeeeee or another package to use..

    I'm not sure that I understand the nature of your question. You are inserting data into a spreadsheet, which is composed entirely of cells, so you have to tell Excel into which cells you want to insert your data. If you don't care which cells they go into, why not just specify (0,0)? Is there any particular reason why you don't want to specify a range?
    Kind Regards,
    E. Sulzer
    Applications Engineer
    National Instruments

  • Error building project using kXML2 - "Class loading error: Wrong name"

    Hi,
    I'm testing the XML-Parser KXML2 and downloaded the latest package, but the minimal version (kxml2-min.zip). I put this file into the directory "%j2mewtk%\apps\KxmlTest\lib" and wrote the lines
    import org.kxml2.io.*;
    import org.xmlpull.v1.*;
    When I try to build the project with the Wireless Toolkit (v1.04) it spits out the following error:
    Error preverifying class kxml2.io.KXmlParser
    Class loading error: Wrong name
    com.sun.kvem.ktools.ExecutionException: Preverifier returned 1
    Build failed
    I also tried the full package "kxml2.zip" but the same error occurs.
    How can I get rid of this? Thanks in advance!

    Okay, finally worked it out (hopefully). I unpacked the archive to a directory (say "%J2MEWTK%\apps\KxmlTest\tmpclasses") and then preverified them "manually":
    %J2SDK%\bin\preverify.exe -classpath "%J2MEWTK%\apps\KxmlTest\tmpclasses";"%J2MEWTK%\lib\midpapi.zip" org.kxml2.io.KXmlParser
    %J2SDK%\bin\preverify.exe -classpath "%J2MEWTK%\apps\KxmlTest\tmpclasses";"%J2MEWTK%\lib\midpapi.zip" org.xmlpull.v1.XmlPullParser
    %J2SDK%\bin\preverify.exe -classpath "%J2MEWTK%\apps\KxmlTest\tmpclasses";"%J2MEWTK%\lib\midpapi.zip" org.xmlpull.v1.XmlPullParserException
    Then I packed them again to a jar-file:
    %J2SDK%\bin\jar.exe -cvf kxml2-min.jar %J2MEWTK%\apps\KxmlTest\tmpclasses\output\.
    That was all!

  • How to parse xml (kXML)

    I have some problems when I try to parse xml with the kXML parser. My xml doc looks like this:
    <?xml version="1.0" encoding="utf-8" ?>
    - <dsGreenRoom>
    - <Rooms>
    - <RoomsInfo>
    <ID>1</ID>
    <Name>Rum 101</Name>
    <Type>Dubbelrum</Type>
    <NumberOfBeds>2</NumberOfBeds>
    <Rate>980,00</Rate>
    <Currency>SEK</Currency>
    <Description>Ett genomtrevligt rum</Description>
    </RoomsInfo>
    - <RoomsInfo>
    <ID>2</ID>
    <Name>Mellanrummet</Name>
    <Type>Enkelrum</Type>
    <NumberOfBeds>1</NumberOfBeds>
    <Rate>650,00</Rate>
    <Currency>SEK</Currency>
    <Description>Ett litet tr?ngt rum i mitten</Description>
    </RoomsInfo>
    - <RoomsInfo>
    <ID>3</ID>
    <Name>Rum 102</Name>
    <Type>Flerb?ddsrum</Type>
    <NumberOfBeds>3</NumberOfBeds>
    <Rate>1250,00</Rate>
    <Currency>SEK</Currency>
    <Description>Ett ?nnu trevligare rum</Description>
    </RoomsInfo>
    </Rooms>
    </dsGreenRoom>
    And my code looks like this:
    KXmlParser parser = new KXmlParser();
                   parser.setInput(is, null);
                   Document doc = new Document();
                   doc.parse(parser);          
                   int child_count = root.getChildCount();
                   System.out.println("child = " + child_count + "\n");
                   for (int i=0; i < child_count; i++) {
              if (root.getType(i) == Node.ELEMENT) {
                   Element kid = root.getElement(i);
                        System.out.println("kid = " + kid.getName());
                   int babies = kid.getChildCount();
                   System.out.println("babies = " + babies);
                   for (int j=0; j < babies; j++) {
                        if (kid.getType(j) == Node.ELEMENT) {
                             Element room = kid.getElement(j);
                             System.out.println("room.getType() = " + room.getType(j));
                        if (room.getName().equals("ID")) {
              System.out.println("elName.getName() = " + room.getName());
              System.out.println("elName.geText() = " + room.getText(j));
              else if (room.getName().equals("Name")) {
              System.out.println("elName.getName() = " + room.getName());
              System.out.println("elName.geText() = " + room.getText(j));
                   } // end for(int j...)
              } // end if (root.getType(i)
              } //for (int i...)
    The problem is that I don't know how to get the values out of the tags:
    <ID>1</ID>
    <Name>Rum 101</Name>
    <Type>Dubbelrum</Type>
    <NumberOfBeds>2</NumberOfBeds>
    <Rate>980,00</Rate>
    <Currency>SEK</Currency>
    <Description>Ett genomtrevligt rum</Description>
    It's no problem to get the value from the firsts i.e. <ID> but I don't know how to get the value from <Name> ... <Description>. I have looked att examples but I don't understand how to do this. Can someone please help me =)

    okay, sorry, I only read the half of your problem ;-)
    You can read the content using the getText(0) method. the 0 indicates the number of the children which you want to get. That is always a 0 because you have always just one text-children in your text-tags. The content is again a children of type text!
    hth
    Kay

  • Query on using kXML parser

    Hi everyone,
    I am writing code to parse a xml document using the kXML parser. My xml document consists of attributes within the tag. My code compiles but when i run i get org.kxml.io.ParseException.
    Something which i found was that, this exception occurs only when there is some attribute within the tag.
    Why is this happening. anyone can help me?
    I would be grateful
    Thanks

    I am using kxml as well to parse a xml file and it's attributes. It works great for me. The ParseException is probably only thrown when you got an illegal xml file (no correct format) I guess.
    But post some code and check your xml file.

  • Preverification Error while using kXML with Netbeans IDE

    Hello All,
    I am using Netbeans IDE for wrting a program that parses a xml using
    kXML and display some results on screen.
    The Netbeans IDE gives the various obfuscation levels.
    The code is properly compiled at any level less than the
    highest obfuscation level. If I compile it at HIGH obfuscation level then it gives the following error-----
    Error preverifying class e
    VERIFIER ERROR e.a(Ll;)Lorg/kxml/kdom/Element;:
    Cannot find class org/kxml/kdom/Element
    D:\Netbeans_Workspace\TestObfuscation\nbproject\build-impl.xml:269: Preverification failed with error code 1.
    BUILD FAILED (total time: 4 seconds)
    How can we obfuscate the program using highest level of obfuscation.
    Thanks
    Vikas

    Thanks Peace,
    But I am facing the same problem even when I use the source java files of kXML and include those in my project and use them as additional classes to my class.
    It again builds properly when I don't use the highest obfuscation level.
    But if I try to obfuscate using Level HIGH it throws the same error.
    However when I try to run this project from J2ME Wireless Toolkit, it is running fine on the emulator.
    I guess the error is something specific to Netbeans IDE. Have anyone of you encountered such a bizzare error.
    Thanks,
    Vikas

  • Problems whilst Parsing XML with KXML2

    I have been doing a lot of reading up on the APIs of XMLPull and KXML2.
    I seem to be facing a problem which can't be solved just by reading but rather the expertise of the more experienced programmers dealing with XML parsing in J2ME.
    I know how long it takes to process an entire XML document, I just would like to parse certain parts of the document. For e.g. instead of reading the whole document, say I just want to read the first 7 items and subsequently, the next 7 items when the user clicks on the next page?
    In other words, I wish to incorporate paging. Is it possible? Or if you have an alternative solution which will not make a user wait too long, please share it!
    Can anyone help me?

    I don't think that is possible. We can't make the XML
    any smaller because it contains all the information I
    want to display. Just that I want to display it in
    pages/sections so as to reduce the load.
    So I was thinking of whether it is possible to read
    the first 5 <title> tags and next 5 for every page
    ... etcimagine that you have 20 pages so the user will have to download a 20 x 5 items xml file?
    if the user stops the navigation at page 4, he will download 16 pages for nothing so that's
    why i told you to separate the results...
    an xml file for each page and not a huge for all !

  • Setting cursor to Start Tag in kXML

    Hi Friends,
    I am parsing XML doc in J2ME app using kXML, after parsing XML once it sets its cursor to the end of document, can anybody tell me how can I set it to start of doc?
    after parsing doc if wanna see where is the cursor, I am using event.getType() and its showing me value '8', which is end of document.
    Thanks,
    Rohan Chandane

    Is this possible?BDB JE does not have a way to index records by ordinal position. This is a common problem with database systems. Please see the following thread.
    Re: traversing and pagination
    If you have additional questions, please don't hesitate to ask.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Problems using kXml

    hi...
    am developing an application where i am using kxml parser.
    am using j2me wireless tool kit and palm emulator.
    while i try to compile my code in the tool kit, it gives error saying :
    c:\WTK104\apps\XMLTest\src\XMLTest.java:5: package org.kxml does not exist
    import org.kxml.*;
    ^
    am sure this problem is due to wrong placement of the package for kxml.
    i have downloaded kxml from the web and unzipped it. please tell me where to put that folder so that my application finds that .
    the import statement in my application is :
    import java.io.*;
    import java.util.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    import org.kxml.*;
    import org.kxml.parser.*;
    thanks
    sanjib

    I used kXML in one of my projects in Eclipse and this is what I did to get it to work:
    Put the kXML JAR file in a folder that will not be included in the package for your project, i.e. NOT in src or lib or anything like that.
    Select your project in Eclipse and choose Configure Build Path.
    Select the Libraries tab and choose 'Add External JAR'.
    Now browse to the kXML JAR file and select it.
    This is the important part now. Now select the 'Order and Export' tab.
    You should see at least 3 entries (your project name, the J2ME Library and now kXML)
    Make sure there is a tick next to the kXML entry, this will tell Eclipse to include the files from the JAR whenever you build your project.
    Now if you select the 'Create Package' option for your project and check inside the created JAR file you should see all of the class files for kXML included in the correct paths.
    Never used anything other than Eclipse so I don't know how this translates, but if you know how to do something similar in the IDE you are using then that'll be the solution. Remember the important part of including the kXML JAR in the export otherwise it won't work.

  • How to use the kxml parser?

    I am getting problem in using the kxml parser.Actually my application is showing the java.lang.NoClassDefFoundError: org/kxml/parser/XmlParser error.
    Can you tell me how to use the kxml parser with our j2me application or what are the steps for this?
    Whether we have to use the kxml.zip or some other JAR file for this?
    Again whether we have to set any classpath for this?

    I was getting same error using kxml parser. The reason is losing interface in which constants are declared.
    You need to correct code of kxml a bit.
    In every place where constant from XmlPullParser interface is referenced only by its name (without reference to its class XmlPullParser) you need to change for use full name. it means changes like:
    START_DOCUMENT to XmlPullParser.START_DOCUMENT
    Everywhere.
    That's all!

  • Issue in parsing an XML using kxml in Creme 4.1 JVM for WIndows CE

    Hi,
    I have written a code to parse an XML using KXML.jar.
    The code will read the XML file, parse the content and writes data to a text file.
    The code is working fine in normal Windows XP enviroment.
    The same code when tested in a pocket PC is not writing the content and also not throwing any error or exception.
    Please give me some inputs on how to resove this issue.
    TIA,
    shubakarthik

    Hi,
    I have written a code to parse an XML using KXML.jar.
    The code will read the XML file, parse the content and writes data to a text file.
    The code is working fine in normal Windows XP enviroment.
    The same code when tested in a pocket PC is not writing the content and also not throwing any error or exception.
    Please give me some inputs on how to resove this issue.
    TIA,
    shubakarthik

  • TinyXML,NanoXML,KXML etc..

    Hi there..
    I need to use any one the above parser for parsing the xml document which is in String format..Can u help
    in how to actually put all the required parser classes into Midp applications..or either to set classpath for that parser..
    Mail me ASAP..[email protected],[email protected]
    with regds,
    Senthil.

    I have been using KXML successfuly. I recommend downloading the code and compiling it along with the rest of your application.
    The code is available through www.kxml.org.
    Go to the downloads section (on the left hand side) and download the kxml-source.zip.
    You will also find some examples there that are fairly straight forwards.
    Post back if you need more help than this.

Maybe you are looking for