Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Why JDOM is light weighted, but still have the Document in memory?

Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, All
In all the articals talk about JDOM, I always found people saying " JDOM is light weighted, it doesn't require the entire document to be in memory." but at the same time "It provides a full document view with random access".
I really can't understand this. SAX is light weighted and takes less memory because it's event driven, that't also the reason we can't "random access" the elements in the XML file.
DOM mapping the whole XML file into a tree hierarchy so we can have random access but that will take a lot of memory if the XML file is big. That's also understandable because we put all the data in the XML into memory.
To me, JDOM document is very similar to a DOM document, it's collected all the information in the XML file and built into a tree hierarchy, so we can have random access but SHOULD take a lot of memory. I know there must be some thing I misunderstood here, but what is it?
Any one can explain this to me? Or I need some example to "convince" me, say, build a JDOM document and a DOM document from the same XML file, then compare their size, but how to implement this exprement.
Thanks for any information. It's really haunting me.
Author and all-around good cowpoke
Posts: 13078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDOM does keep the document in memory, it is just a simplified DOM - closer to Java than the w3c DOM.
Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic