Comparing DOM and SAX is like comparing apples and bullfrogs.  They do
two largely different things.  DOM reads in an entire XML document and
stores it as Java objects so that you can quickly reference parts of
it without knowing (or at least having to specify) in advance what
parts you're interested in.  SAX (rapidly) parses an XML file but
leaves it up to you to know (and write code for) which parts to save
as it speeds by.

A new, "middle of the road" technology is "pull parsing", which uses a
SAX-like scanner but lets you specify in advance which elements you
want saved.

Another option is to use a lighter weight markup language.  JSON is
much more compact, parses much faster, and is generally easier to deal
with.

If you want to "cache" an XML file it would make more sense to cache
the parsed information vs the original file, if parsing speed is
already an issue.  There are a dozen different ways to cache the
parsed information, depending on its size and structure.

On Aug 16, 9:02 am, Davide <d...@vide.bz> wrote:
> Hi,
>
> I have seen that xml parsing is very slow. Using sax would be better,
> but benchmark show that sax work only 30%
> faster as dom. Is right? Is faster if I construct a "DOM" using sax?
>
> To reduce time i like to cache xml file. Caching it as xml is not a
> good idea because the parsing time is there again
> the secondo time.
>
> Should I use sqllite? Is faster? Is an idea to use an
> ObjectOutputStream? Can I put in asset a file maked by
> ObjectOutputStream
> or the serialized objects can be different in different mobile hardware?
>
> --
>   _|  _.    o  _|  _
>  (_| (_| \/ | (_| (/_

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to