Parsing XML file with Sax question...

Discussion in 'Java' started by Nathaniel Hughes, Jan 14, 2004.

  1. 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.
     
    Nathaniel Hughes, Jan 14, 2004
    #1
    1. Advertising

  2. "Nathaniel Hughes" <> wrote in message
    news:p...
    > 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
     
    Silvio Bierman, Jan 14, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Per Magnus L?vold
    Replies:
    0
    Views:
    1,425
    Per Magnus L?vold
    Nov 15, 2004
  2. Naren
    Replies:
    0
    Views:
    599
    Naren
    May 11, 2004
  3. Willem Ligtenberg

    XML file parsing with SAX

    Willem Ligtenberg, Apr 23, 2005, in forum: Python
    Replies:
    3
    Views:
    3,694
    Uche Ogbuji
    Apr 23, 2005
  4. Replies:
    2
    Views:
    512
  5. Erik Wasser
    Replies:
    5
    Views:
    500
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page