aspose file tools*
The moose likes XML and Related Technologies and the fly likes split big DOM xml file  ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "split big DOM xml file  ??" Watch "split big DOM xml file  ??" New topic
Author

split big DOM xml file ??

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1378
How can i split big DOM xml file in to small files?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You could do that in two ways:

1) Use XML entity references in a top-level XML document to "include" other XML documents. This approach splits the file, but the DOM parser will still read it as one big XML document.

2) Split the XML document and write Java code to merge the documents together after parsing each.

Could you explain a bit more about why you need to split the big file?


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

Joined: Apr 08, 2004
Posts: 1378
If i use big DOM xml file, it occupies more memory. I want to reduce this..
JayaSiji Gopal
Ranch Hand

Joined: Sep 27, 2004
Posts: 303
If it is about parsing a big xml file and working with the nodes, u can use SAX parser. SAX is event based. Hence, memory constraints are reduced.


SCJP 1.4, SCWCD 1.4<br /> <br />Thanks in advance!<br />Jayashree.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
I think the important question is - what kind of processing do you have to do with the big XML file?
For a simple pass through the entire document, extracting specific information, SAX processing will use very little memory.
If you have to modify the document structure extensively and rewrite it you may be buying more memory...
How big are we talking about anyway?
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: split big DOM xml file ??