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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:53:14+00:00 2026-05-13T12:53:14+00:00

Does reading XML data like in the following code create the DOM tree in

  • 0

Does reading XML data like in the following code create the DOM tree in memory?

my $xml = new XML::Simple;

my $data = $xml->XMLin($blast_output,ForceArray => 1);

For large XML files should I use a SAX parser, with handlers, etc.?

  • 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-13T12:53:14+00:00Added an answer on May 13, 2026 at 12:53 pm

    I would say yes to both. The XML::Simple library will create the entire tree in memory and it’s a large multiple on the size of the file. For many applications if your XML is over 100MB or so, it’ll be practical impossible to entirely load into memory in perl. A SAX parser is a way of getting “events” or notifications as the file is read and tags are opened or closed.

    Depending on your usage patterns, either a SAX or a DOM based parser could be faster: for example, if you are trying to handle just a few nodes, or every node, in a large file, the SAX mode is probably best. For example, reading a large RSS feed and attempting to parse every item in it.

    On the other hand, if you need to cross-reference one part of the file with another part, a DOM parser or accessing via XPath will make more sense – writing it in the “inside-out” manner that a SAX parser requires will be clumsy and tricky.

    I recommend trying a SAX parser at least once, because the event-driven thinking required to do so is good exercise.

    I’ve had good success with XML::SAX::Machines to set up SAX parsing in perl – if you want multiple filters and pipelines it’s easy to set up. For simpler setups (i.e 99% of the time) you just need a single sax filter (look at XML::Filter::Base) and tell XML::SAX::Machines to just parse the file (or read from filehandle) using your filter. Here’s a thorough article.

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

Sidebar

Related Questions

I am reading data from another system that returns XML that provides the following
When learning new languages such as C++ from PHP, does reading other language snippets
After reading the following article Create Test Conditions for the Database Unit Test Designer
I was reading a piece of code from the XStreamingReader library (which seems like
There's some legacy code that I would like to refactor. There is some data
Why does reading from __DATA__ work and reading from the file doesn't (Loose unescaped
How does performance for reading/adding values from/to Dictionary(Of String, SomeReferenceType) depend on the number
Does anyone know how to adjust the iPhone's compass reading to adjust if you
Does anyone know if there is a builtin function for reading from the console
I'm reading PEP 8 and notice that it does not say anything on maximum

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.