Storing (retrieving) data in (from) an XML file

Hi all,

I'm looking at storing some simple objects in XML files or a single XML file.

I was just wondering if J2ME CDC/Personal Profile has any packages that I should look into using. The idea is I'll have some (0..n) top level documents with 0..n name-value pair attributes and 0..n child documents.

I plan to use XML because of it's platform independance, and since the data I'm planning to store will not be overly complex or of large quantities I believe this to be a reasonable choice.

If anyone would like to suggest a different platform for data storage I'd be interested to hear your case.

So, does anyone have any idea on what packages I should be looking at or perhaps some examples?

Thanks in advance,

Joe

[770 byte] By [ChromeDomea] at [2007-10-2 5:32:18]
# 1
Can you use JABX on J2ME devices?Or does it depend on the JVM? Does the J9 JVM support it?
ChromeDomea at 2007-7-16 1:43:12 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
I'd suggest you evaluate the possibility of taking NanoXML/Lite and stripping it down a bit. There's some discussion of this in one of the two really long threads that are always on the front page of this forum.
YAT_Archivista at 2007-7-16 1:43:12 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

I suggest to you use KXML.

It's very light and ease to use.

You can go to http://kxml.sourceforge.net/kxml2/

There you can download the API and all documentation needed.

You can go to http://xmlpull.org/. There you can find many documentation and articles about the use of kxml.

I hope it can help you.

aboaventuraa at 2007-7-16 1:43:12 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

After looking at both of them I think I'll go with nanoXML lite.. only because it seems simpler to use.

I'm having a problem when parsing my files using a FileReader though. It seems that there are some weird characters at the beginning of my files (These have been created in various methods.. from notepad and other text editors to Visual Basic). Any idea how I can remove these characters or where they have come from or why they are there?

Thanks in advance,

Joe

ChromeDomea at 2007-7-16 1:43:12 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 5
At a guess they'd be a byte-order mark. Can you look at them in a hex editor and post their hex values?
YAT_Archivista at 2007-7-16 1:43:12 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 6
Got it in 1..I think the files I was having problems with were written in VB. I just had to initialise my UTF-8 encoding to not use a byte order markThanks,Joe
ChromeDomea at 2007-7-16 1:43:12 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 7
by written in VB I mean't written by a VB program..
ChromeDomea at 2007-7-16 1:43:12 > top of Java-index,Java Mobility Forums,Java ME Technologies...