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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:19:34+00:00 2026-06-04T11:19:34+00:00

I’m trying to edit a large XML file (extracted from an Excel .xlsm file)

  • 0

I’m trying to edit a large XML file (extracted from an Excel .xlsm file) using PHP, and I was wondering which is best (regarding performance) : QueryPath or PHP’s DOMDocument ?

The file weighs at least 8 MB, and contains around 400k lines (when formatted).

Thanks for the feedback

  • 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-04T11:19:35+00:00Added an answer on June 4, 2026 at 11:19 am

    QueryPath is basically just a wrapper around DOMDocument. It adds relatively little overhead to a bare DOMDocument object. For accessing and writing operations — things like attr(), append(), and such, there should be no noteworthy performance difference.

    But then it comes to the big issue: Finding stuff.

    Traditionally, traversing a DOMDocument is done by either “walking the tree” or using DOMNode->getElementsByTagname(). This preforms relatively well if you’re willing to write the code.

    Querying with QueryPath 2.x will be sorta slow on a document that size unless you use very specific selectors (e.g ‘:root>foo>bar>baz’).

    However, QueryPath 3.x, which is about to go into Alpha1 is many, many times faster when querying large objects. Doing qp('foo') is as fast as XPath… which brings me to the last option.

    Then there’s the built-in XPath processor that also comes with PHP’s libxml support. That might give you better performance if you’re doing a large XML document, since it is executed at C speed instead of at PHP speed. But you will have to write XPath expressions, which are (IMHO) sort of a pain.

    So the bottom line:

    • Basics: Either one will do.
    • Modification: Either one will do.
    • Lots of traversing:
      • DOMDocument will make you traverse manually.
      • QueryPath 2.x is slow
      • QueryPath 3.x is much faster
      • XPath is fastest… but it’s XPath
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
In my XML file chapters tag has more chapter tag.i need to display chapters
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I'm parsing an XML file, the creators of it stuck in a bunch social

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.