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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:30:11+00:00 2026-06-16T07:30:11+00:00

I’m dealing with quite a big XML file that I need to parse and

  • 0

I’m dealing with quite a big XML file that I need to parse and for memory usage problems I was thinking about reading only parts of this file , is there a way to do this.Thanks.

  • 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-16T07:30:12+00:00Added an answer on June 16, 2026 at 7:30 am

    Depending upon the format of your data, ElementTree (here, here) or lxml (which supports the ElementTree API; here, here) will probably do what you need. It’s a bit of a hybrid between event-oriente and DOM-oriented parsers, allowing you to iterate over high-level subtrees using the iterparse() method, interrogating the internals of each subtree in turn.

    This method is slower than SAX (in my use I’ve noticed it to take 2-4 times as long), but the resulting code ends up being easier to understand, maintain, and reuse. Compared to a straight-up DOM parser, as it discards visited elements during iteration, memory use is much more manageable. My experience is only with the built-in xml.etree.ElementTree library; lxml or other libraries which support the API (or perform similar functions differently) will have different characteristics.

    ElementTree works well iteratively if you can easily break the document into chunks—for example, a document that contains thousands of product descriptions, where the root element contains essentially a list of products that can easily be iterated over. If, on the other hand, your documents simply contain a lot of unstructured/unparsed data, you still may have some work ahead of you to make memory usage manageable.

    Hope that helps.

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

Sidebar

Related Questions

In my XML file chapters tag has more chapter tag.i need to display chapters
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I need a function that will clean a strings' special characters. I do NOT
I'm parsing an XML file, the creators of it stuck in a bunch social
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
i want to parse a xhtml file and display in UITableView. what is the
I am reading a book about Javascript and jQuery and using one of the
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.