Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

split big DOM xml file ??

 
kri shan
Ranch Hand
Posts: 1460
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i split big DOM xml file in to small files?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
kri shan
Ranch Hand
Posts: 1460
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i use big DOM xml file, it occupies more memory. I want to reduce this..
 
JayaSiji Gopal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic