I have created XML file,but I can’t view it/output it.I know there is no way to output created XML file.
Can anyone please suggest what is better way of creating xml files?
1. create xml with DocumentBuilderFactory and then parse it Or
2. manually create hardcoded xml and save it on sd card and then access it for parsing.
I have continuosly varying text data in xml files.
Which approach will suite me most?
I’m using kXML2 to create/chage/save/read xml. Using it with BlackBerry remember:
– for release you have to preverify it & build proj with ant
Ahmad Ferdous Bin Alam – How to Import kxml jar File to Your Project
Slashdev – BlackBerry Development with Ant & Eclipse
UPDATE: Tutorial: How To Use 3rd Party Libraries in your Applications
– for debug you have to add kXML sources and org.xmlpull.v1 sources to your BB project
Create XML
Save XML on BlackBerry filesystem
be sure you have access rights for read/write operation
See also:
RIM API – Interface FileConnection
SUN Dev Network – Getting Started with the FileConnection APIs
RIM – How To – Add plain text or binary files to an application
BB Support Forum – Some questions about FileConnection/JSR 75
Sony Ericsson Forum – Create XML file
Read XML file
See also:
RoseIndia.net – J2ME Kxml Example
Change XML document
All you have to do is get needed element and change it:
Output XML document to BlackBerry screen (somewhere in Screen class)
Simply serialize xml doc to string and put it in RichTextField: