BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 03-25-2009, 08:41 AM   #1
abhiyenta
Knows Where the Search Button Is
 
Join Date: Mar 2009
Model: 8120
PIN: N/A
Carrier: gmail
Posts: 18
Default SAX or DOM for BlackBerry application

Please Login to Remove!

i am going to store some data in xml file, in my BlackBerry Application
.which i can retrieve later or could modify the content of xml file..............but i m bit confused about which API to use....Whether DOM approach wld be good or SAX....
Offline  
Old 03-25-2009, 01:34 PM   #2
Ted Hopp
New Member
 
Join Date: May 2008
Model: none
PIN: N/A
Carrier: none
Posts: 4
Default

A web search for "sax vs dom" will turn up lots of good information about this. I don't think this question has any considerations that are specific to BlackBerry development; both parsers are supported and work well.
Offline  
Old 03-26-2009, 04:27 AM   #3
Ivanov
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Default

DOM is holding the whole xml document in memory in the form of a tree and that IS something to consider in mobile development. I f you have an XML based database engine which might grow very quick or just very big XML to parse you might run out of memory.
SAX is event based and allows quick parsing without building the data tree like DOM.

So it depends on what do you want to do. If you have an object serializer and need to map an xml file to a structure use DOM. If you only need a specific value from your xml file use SAX.
__________________
Blessed is the end user who expects nothing, for he/she will not be disappointed. (Franklin's Rule)
Offline  
Old 03-27-2009, 12:53 PM   #4
WonderfulRemote
Knows Where the Search Button Is
 
Join Date: Feb 2009
Model: 9000
PIN: N/A
Carrier: AT&T
Posts: 16
Default

if its a quick and relatively simple bit of data your storing I'd go with sax, and pop all the data into xml tags with attributes. i.e. this works, its fast and efficient and is very easy to do provided avoid using heavily nested structures.
If you need to parse more complex structures I would recommend that you check out kxml2 its a nice J2ME xml pull parser.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


1pcs used TSXMFPP128K Memory Card picture

1pcs used TSXMFPP128K Memory Card

$175.00



Lot Of 2 Samsung ESD DIMM DDR Memory Tray 25 Pcs DDR2 DDR3 DDR4 w/ Original Box picture

Lot Of 2 Samsung ESD DIMM DDR Memory Tray 25 Pcs DDR2 DDR3 DDR4 w/ Original Box

$10.50



Desktop Memory Case Tray Case for PC DDR DRAM RAM DIMM Modules - 2 fits 100 New picture

Desktop Memory Case Tray Case for PC DDR DRAM RAM DIMM Modules - 2 fits 100 New

$20.50



2 - RAM DRAM Tray-Container Box For Server PC Memory DIMM Modules - Fits 100 NEW picture

2 - RAM DRAM Tray-Container Box For Server PC Memory DIMM Modules - Fits 100 NEW

$21.90



Siemens 6ED10521MD000BA8 Logic Memory Module DMB 12/24 AM2 RTD  Expansion NOB picture

Siemens 6ED10521MD000BA8 Logic Memory Module DMB 12/24 AM2 RTD Expansion NOB

$135.00



Argolladora We R Memory Keepers Heidi Swapp Cinch Binding Machine 71050-9 by AC picture

Argolladora We R Memory Keepers Heidi Swapp Cinch Binding Machine 71050-9 by AC

$79.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.