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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:01:43+00:00 2026-05-12T16:01:43+00:00

I currently do alot of data parsing, and have toyed with PHP functions for

  • 0

I currently do alot of data parsing, and have toyed with PHP functions for XML such as simple XML and a few others here and there.

But there always seems to be some sort of issue with dealing with them, mainly due to the way the data is presented.

The most reliable way i have found is to always just simply use preg_match_all and regular expression to pull the my data in to the script for processing.

Does anyone see a problem with this? what are the cons of using Regular expression rather than ready build XML parsers?

My main concern is speed and server utilization of resources.

  • 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-12T16:01:43+00:00Added an answer on May 12, 2026 at 4:01 pm

    If you use DOMDocument and DOMXpath, I suspect these will solve your problems.

    See https://www.php.net/manual/en/class.domdocument.php and https://www.php.net/manual/en/class.domxpath.php

    Could you provide an example of what you are trying to do, though?

    Edit
    To directly answer your question, though: regular expressions are easy to mess up — especially processing hierarchical structures like xml. Even if you do it right, it will likely be slower than using xpath.

    Edit 2
    Just to add, php’s implementation of xpath, DOMXpath only supports xpath 1.0. If you need to use regular expressions to evaluate the contents of an element or one of its attributes, then you’d need something supporting xpath 2.0…. or go with a risky, error-prone regex.

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

Sidebar

Related Questions

I have a xml document ~10mb in size. It has relatively simple structure but
I have a list of products I want to generate xml for currently all
I am currently writing a simple piece of IO parsing, and is in a
We currently have a utilities class that handles a lot of string formatting, date
Currently I have a lot of python objects in my code similar to the
I am currently building an Book-App (sort of). So there are a lot of
Currently I have a class that looks like this: public class MyClass : IMyClass
Beginner here: In this answer to my question of how to insert data into
I have been using BinaryFormatter to serialise data to disk but it doesn't seem
I have read a lot of discussions here on SO, watched Jon Moore's presentation

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.