I want to read a large xml file and display graphically in swing as a tree structure.
I implemented it and works fine for files of 5MB size after increasing the jvm heap size (-Xmx). If the file size is larger than 5MB it throws out of memory error. I'm creating a custom datastructure from the xml and I'm using sax parsing.
After displaying the datastructure, the user could do some operation on this, like search etc.
Can any of you suggest a method, to support larger files ? What I'm looking for is create the datastructure in file system, rather than in memory.
I guess a solution would depend on the shape of your hierarchy. If there is some element X that is convenient for breaking the structure into small bits, you could write a new XML document for each X and track the filenames in memory. SAX events are convenient for this - you would start a new file everytime startElement got an X element. Bill
Joined: Dec 01, 2005
This solution would've been possible if the input xml files have the same schema.
But in my case input files will have different schemas. So I have to do the memory management at the data structure level.
Is there any way we can do it through object serialization?
Author and all-around good cowpoke
Joined: Mar 22, 2000
Yow! what an interesting problem. If you can't rely on a common schema to give you break points, is there anything regular in the structure of the XML that you can rely on?
I suppose you could represent a XML document as a sequence of these custom datastructure objects - if they are Serializable. What sort of processing are your users going to be doing to a document? Bill
Joined: Dec 01, 2005
The basic operation I want to provide is to compare two xml files and display the changed nodes with different colors. then there could be renaming of some nodes, merging of nodes etc.
I created a datastructure where the children of each node is stored in a vector in that node... recursively .. so one xml file is converted in to one of such object.
The solution I'm looking for is, like when a user clicks on a node, load the immediate children of that node. But I'm not able to do that. And I found that serialization and deserialization is too slow if there are a large number of objects.
subject: parse large xmlfile and display using swing