Discussion Board

Results 1 to 5 of 5

Thread: KXML code

  1. #1
    Regular Contributor binsint's Avatar
    Join Date
    Nov 2010
    Posts
    118
    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 grahamhughes's Avatar
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,394
    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 binsint's Avatar
    Join Date
    Nov 2010
    Posts
    118
    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
    Nokia Developer Champion njzk2's Avatar
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814
    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
    Nokia Developer Champion traud's Avatar
    Join Date
    Mar 2003
    Posts
    3,892
    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. using kxml parser
    By smart@gayu in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2007-06-10, 18:07
  4. kxml and NDS
    By shantanu_chawla in forum Mobile Java General
    Replies: 1
    Last Post: 2005-11-30, 14:23
  5. 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
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved