Parsing XML file with Sax question...

N

Nathaniel Hughes

Hey all,
So I'm trying to create a java app that will display the contents of
an xml file in text format. The output must be similar to what is shown
if an xml doc is viewed in IE. The problem that I'm running into is that
due to the size of the files (100 megs plus), I have to use a SAX parser
instead of a DOM, and so far, I've yet to find a solution to traversing
"back-up" an xml file using a sax parser. Does anyone have any ideas?

Just to clarify, a sax parser can send me the output of a file just fine,
and I can display chunks of it at a time in the window of my app. If
someone scrolls down the page, I can just continue to grab info from my
parser (possibly using a "pull" method), but once someone scrolls back up
the page I have to retrieve that info from the xml file but I have no
handle there. I have to start from the top and somehow determine where in
the file I need to start grabbling info...

Hope that makes sense, any help would be greatly appreciated.
 
S

Silvio Bierman

Nathaniel Hughes said:
Hey all,
So I'm trying to create a java app that will display the contents of
an xml file in text format. The output must be similar to what is shown
if an xml doc is viewed in IE. The problem that I'm running into is that
due to the size of the files (100 megs plus), I have to use a SAX parser
instead of a DOM, and so far, I've yet to find a solution to traversing
"back-up" an xml file using a sax parser. Does anyone have any ideas?

Just to clarify, a sax parser can send me the output of a file just fine,
and I can display chunks of it at a time in the window of my app. If
someone scrolls down the page, I can just continue to grab info from my
parser (possibly using a "pull" method), but once someone scrolls back up
the page I have to retrieve that info from the xml file but I have no
handle there. I have to start from the top and somehow determine where in
the file I need to start grabbling info...

Hope that makes sense, any help would be greatly appreciated.

Did you try what IE does with such a bug XML doc? IE transforms the XML to
some HTML representation of the tree structure and displays that as a normal
HTML page including scrollbars. The same way you could fill a tree control
with the XML data. Navigating back and forth is as far as I know not
possible with SAX.

Regards,

Silvio Bierman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top