This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes JDOM parsing and memory Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "JDOM parsing and memory" Watch "JDOM parsing and memory" New topic
Author

JDOM parsing and memory

Bhasker Reddy
Ranch Hand

Joined: Jun 13, 2000
Posts: 176
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(billFile);
Element root = doc.getRootElement();

I am trying to parse an xml file using JDOM. I am using above lines to create the document from billFile which is a File object. At this point,
doc is in memory. Does it means it holds entire document in memory or it only holds some information, pulls it as and when required.
please clarify


Bhasker Reddy
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
It's all in memory. In other words, holding a reference to a JDOM document built from an XML file of 3 megabytes will take at least 3 megabytes of memory ("at least" because the object structure takes more space than the raw data).


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Kumar Bisk
Ranch Hand

Joined: Mar 18, 2003
Posts: 30
There will be no reference in this case. Everything will be stored in memory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDOM parsing and memory
 
Similar Threads
How to remove special/Invalid charchters before reading the XML file
Formatting XML string?
Need help in replacing a node value
Allowing & br tags to show using XSL
Parsing XML, should I use SAX or DOM?