Skip to main content

Vectors vs XML

3 replies [Last post]
Anonymous

In the past we had phones with very limited memory so I have been using
Vectors to save values and then when I am ready to send the data, formatting
it into a psuedo XML stream, and sending to the server. This approach has
worked well with the limited memory we had in the old phones with MIDP 1.0,
I sometimes had as many as 600 scanned items to transmit and sent it in
chunks to the server.

As we have faster processors and more memory I find that I need more complex
data structures, Vectors inside Vectors and I am starting to think it may be
better to use a parser like KXML to create and maintain an XML document in
memory. This would allow for children within children and I could still read
through the document and send chunks to the server. It also make persisting
the data easy to the File system if there is no network. Has anyone else
started using parsers like KXML in memory and what has been your experience?
Do you think there is enough resources to keep this running and is it
essentially the same as having many Vectors in memory?

Thanks

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
davjoh
Offline
Joined: 2007-07-18
Points: 0

> Has anyone else
> started using parsers like KXML in memory and what
> has been your experience?
> Do you think there is enough resources to keep this
> running and is it
> essentially the same as having many Vectors in
> memory?
>
> Thanks
>

I've had some experience of using kXML within our kXML-RPC project. The only reported memory problems we've had so far from users is with parsing responses where they get out of memory at about a 30k reposnse (XML-RPC responses are parsed and turned into equivalent objects). I expect any resource limitation would be dependent on the device though, unless Java ME limits memory usage.

-David

akhilarora
Offline
Joined: 2004-12-17
Points: 0

For a simpler alternative to XML - see the JSON library at https://meapplicationdevelopers.dev.java.net/mobileajax.html

Daniel Rocha

>From what I know, kXML is a pull parser, not a model parser. NanoXML and
TinyXML are model parsers, so you probably should use one of them if
you're planning to store in-memory document trees.

Here's a few more parsers:
http://developers.sun.com/mobility/midp/articles/parsingxml/

>From a Nokia device standpoint, I would say that Series 40 3rd Edition+
and S60 2nd Edition FP1+ have enough heap memory to store complex
document trees, but for older devices it's still a no-no. It all depends
on how much memory you're hoping to use, and what are your target
devices. I think that it may generate multiple versions of your app if
you're targeting several devices, but as I said this will depend on your
targets.

One other thing you have to consider is what else your application is
doing. If it's storing a 300kb document in memory and trying to either
record video or capture pictures at the same time (which takes up a lot
of memory), then perhaps it's a better idea to stick to the simple data
structures version.

[]s
Daniel

________________________________

From: A mailing list for KVM discussion
[mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of ext Chris Rotberg
Sent: Saturday, August 11, 2007 3:29 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Vectors vs XML

In the past we had phones with very limited memory so I have been using
Vectors to save values and then when I am ready to send the data,
formatting it into a psuedo XML stream, and sending to the server. This
approach has worked well with the limited memory we had in the old
phones with MIDP 1.0, I sometimes had as many as 600 scanned items to
transmit and sent it in chunks to the server.

As we have faster processors and more memory I find that I need more
complex data structures, Vectors inside Vectors and I am starting to
think it may be better to use a parser like KXML to create and maintain
an XML document in memory. This would allow for children within children
and I could still read through the document and send chunks to the
server. It also make persisting the data easy to the File system if
there is no network. Has anyone else started using parsers like KXML in
memory and what has been your experience? Do you think there is enough
resources to keep this running and is it essentially the same as having
many Vectors in memory?

Thanks

========================================================================
=== To unsubscribe, send email to listserv@java.sun.com and include in
the body of the message "signoff KVM-INTEREST". For general help, send
email to listserv@java.sun.com and include in the body of the message
"help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]