BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/index.php)
-   Developer Forum (http://www.blackberryforums.com/forumdisplay.php?f=15)
-   -   SAX or DOM for BlackBerry application (http://www.blackberryforums.com/showthread.php?t=182926)

abhiyenta 03-25-2009 08:41 AM

SAX or DOM for BlackBerry application
 
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....

Ted Hopp 03-25-2009 01:34 PM

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.

Ivanov 03-26-2009 04:27 AM

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.

WonderfulRemote 03-27-2009 12:53 PM

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.


All times are GMT -5. The time now is 11:45 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.