Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8744555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:51:32+00:00 2026-06-13T11:51:32+00:00

I need to parse a huge xml file on server and send it to

  • 0

I need to parse a huge xml file on server and send it to client.
I want to do the parsing on demand – meaning, to only parse and show the parent nodes at first, and when the client clicks on a parent node – to send a request to the server that tells which parent was selected, and just then to parse and send its children (again, not the whole sub-tree, but just the parents).
I thought about using STAX parser, but I don’t understand how to work with it when it comes to parent-children relationship. How do I tell the parser not to continue to the next START-ELEMENT which is the child, but to skip to the next parent in its level? and also – is there a way to go back with the ITERATOR implementation? after choosing one parent and seeing its children, can I go back and see a previous parent?
I would really appreciate any suggestion!
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:51:33+00:00Added an answer on June 13, 2026 at 11:51 am
    1. No, you can’t skip a sub-tree of an XML document without parsing it first. That is true for every parser, not just StAX. (Knowing which point to skip to implies that you’ve already parsed the elements in between.)

    2. However by maintaining a nesting level counter that you increment with every start element event and decrement with every end element event, it’s easy to ignore all the events that come from a level below your target level.

    3. Parsing is one way, not random access, you can’t jump back and forth. (Again, this would assume that the parser stores a representation of everything parsed so far, which is exactly what StAX was created to avoid.) But of course you can try to record the byte position of each parent tag in the file, then later seek to it if you’ve got the file open for random access. There are quite a few pitfalls to this approach though.

    All in all, your use case doesn’t look like a good fit for StAX. Have you tried VTD-XML? Depending on how big your file is, it can be exactly what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need to parse a text file into a specific xml format.(file is a huge
I need to parse a huge xml feed containing games data and download all
I have a requirement to parse a huge text file and send parts of
I need to parse potentially huge XML files, so I guess this rules out
I have a huge XML file with loads of data, I need to create
I need parse through a file and do some processing into it. The file
Need to parse a file for lines of data that start with this pattern
I need to parse a protocol buffer send via a post using bottle. How
I have a huge XML files up to 1-2gb, and obviously I can't parse
I got some huge files I need to parse, and people have been recommending

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.