aspose file tools*
The moose likes XML and Related Technologies and the fly likes How can I split one XML file into Two files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How can I split one XML file into Two files" Watch "How can I split one XML file into Two files" New topic
Author

How can I split one XML file into Two files

BalaiahRaju ChamarthiRaju
Greenhorn

Joined: Sep 18, 2007
Posts: 13
Hi,

I have a task need to split one xml file into two files. this is because of my application supports only 5MB xml to load.. rarely I am getting 10MB files also, such scenarios my application is not able to load the file.

Please give me light on this whether is there any tool or any mechanism to split XML file.

Thanks in Advance
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Well you could write a piece of custom Java which split the file if if gets beyond a certain file size. The tricky part will be deciding where to split that file and whether or not you need to merge that file back together...


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18908
    
    8

If you want to extract a subset of the file (a generalization of your "split one file into two files"), a common way to do that is with a SAX filter. Google the expression for examples.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I split one XML file into Two files