×

Discussion Board

Results 1 to 5 of 5

Thread: KXML code

  1. #1
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    118

    KXML code

    Hi everyone! can anyone share a very very simple complete code that creates and writes into an xml file a root node and one child element using kxml? please? I need it as my reference.. thanks

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: KXML code

    kXML is a parser for XML, not a generator. It's only for reading XML. To write, you have to construct the XML yourself.

    I know of no XML generation library for Java ME.

    Graham.

  3. #3
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    118

    Re: KXML code

    yeah.. I have my generated xml files placed on my phone but is it possible to insert and remove nodes and elements inside?

  4. #4
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: KXML code

    you would need a dom library or something alike. i suggest you either use a transition data model in which you insert/remove elements before you format the xml, or that you use another format. JSON would be quite indicated for that.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: KXML code

    kXML 2 is very complete and contains not only Pull but DOM as well. I recommend to go out for a book about XML. Then have a look at the API of kXML again. If you understand XML, kXML is rather intuitive and allows you to create your files as well.

    If you just append text at the start and end of your XML file, write the new start to an OutputStream, write the XML to that OutputStream, and write the new end to that OutputStream.

    binsint, looking at all your various threads, I wonder if you need that at all: Who requires you to have an element root around of your XML? Who requires you to have a XML declaration? Yes, why do you deal with XML at all?
    Last edited by traud; 2011-01-26 at 13:39.

Similar Threads

  1. I need kXML 1.* library
    By naim05 in forum Mobile Java General
    Replies: 2
    Last Post: 2011-01-13, 17:50
  2. How to use the kxml parser
    By dhiraj.deka in forum Mobile Java General
    Replies: 7
    Last Post: 2009-11-03, 16:16
  3. kxml and NDS
    By shantanu_chawla in forum Mobile Java General
    Replies: 1
    Last Post: 2005-11-30, 14:23
  4. kXML 2 problem
    By markber in forum Mobile Java General
    Replies: 4
    Last Post: 2003-07-07, 14:06

Posting Permissions

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