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 7430221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:06:13+00:00 2026-05-29T09:06:13+00:00

Hello fellow developers… just to make sure, I want to ask this question: How

  • 0

Hello fellow developers… just to make sure, I want to ask this question:

How does XML SAX parser access the .xml file it is parsing? Does it download the whole file from the given URL?

Is there any use in breaking the parsing so that we can save some kilobytes of data?

Imagine a large .xml file with ordered items. We need only several items from the top, the other items may already be processed and stored. When I stop the parsing at specific point, will I save some data (surely I will save some time).

Thanks for answers.

  • 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-29T09:06:14+00:00Added an answer on May 29, 2026 at 9:06 am

    SAX parser implementations exist in many languages, and the answer may be implementation-specific. But at least the common Java implementations can read the xml from a stream and needn’t download the entire thing.

    An invocation of a Java SAX parser to parse from a URL usually looks something like

            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp = spf.newSAXParser();
            XMLReader xr = sp.getXMLReader();
            MyHandler handler = new MyHandler();
            xr.setContentHandler(handler);
            xr.parse(new InputSource(sourceUrl.openStream()));
    

    where the handler MyHandler is a class you define implementing org.xml.sax.ContentHandler (most easily by extending org.xml.sax.helpers.DefaultHandler) and sourceURL is a java.net.URL for the URL.

    Of course all this has to be enclosed in a try-catch…

    Your handler can throw an exception signaling that it has reached the end of what you want to parse, and by catching this exception, your program can cleanly finish without reading the entire stream.

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

Sidebar

Related Questions

Hello fellow software developers. I want to distribute a C program which is scriptable
Hello fellow Computer People! I could do this myself, but was just wondering if
Hello fellow travelers of Stack Overflow. I'm not entirely certain how to ask this
Hello fellow developers, I am a little stumped on this one as I have
hello fellow java developers. I'm having a bit of an issue here. I have
I want to include Core Location and I'm trying to follow this tutorial: http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/
Hello fellow developers. First of all I apologize beforehand for the wall of text
Hello fellow developers. I have previously made a facebook fan page with an iframe
Hello fellow Grails Developers! I was wondering if you could help me with what
hello fellow java developers. I'm having a very strange issue. I'm trying to read

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.