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

  • SEARCH
  • Home
  • 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 777683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:38:46+00:00 2026-05-14T19:38:46+00:00

What I would really like is a streaming API that works sort of like

  • 0

What I would really like is a streaming API that works sort of like StAX, and sort of like DOM/JDom.

It would be streaming in the sense that it would be very lazy and not read things in until needed. It would also be streaming in the sense that it would read everything forwards (but not backwards).

Here’s what code that used such an API would look like.

URL url = ...
XMLStream xml = XXXFactory(url.inputStream()) ;


// process each <book> element in this document.
// the <book> element may have subnodes.
// You get a DOM/JDOM like tree rooted at the next <book>.


while (xml.hasContent()) {
  XMLElement book = xml.getNextElement("book");
  processBook(book);
}

Does anything like this exist?

  • 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-05-14T19:38:47+00:00Added an answer on May 14, 2026 at 7:38 pm

    You could do the following:

    1. Scan the XML file using SAX or StAX and immediately serizalize everything back into a StringBuilder, i.e. create your own copy of the XML file.

    2. If you encounter a endElement and you know you don’t need the subtree you just parsed, clear the StringBuilder.

    3. If you need it, you can build a DOM tree from the “copy” you created.

    With this you can fall back to standard frameworks, one for conventional SAX parsing and one for conventional DOM building. Only the custom serizalization might require some hacking.

    Also it helps if you need to know the tree boundaries in advance. (book elements in your example) Otherwise further processing would be required.

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

Sidebar

Related Questions

I would really like to provide the user some scripting capabilities, while not giving
I would really like to actually only allocate 64KB of memory, not 128KB and
I would really like to make a form instance a model attribute so that
I would really like to do something like this: Callable<MyObject> myCallable = .... Future<MyObject>
I would really like to know how web sites decide what ad to show
I would really like to add an image into the Sandcastle generated help file
I would really like your help in knowing the procedure to delete a .3gp
I'm learning iOS development and would really like to look at an example application
I know this isn't a programming question but I would really like the users
Does anyone know of an equivalent to FxCop/StyleCop for Delphi? I would really like

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.