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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:15:46+00:00 2026-05-12T07:15:46+00:00

How does one intelligently parse data returned by search results on a page? For

  • 0

How does one intelligently parse data returned by search results on a page?

For example, lets say that I would like to create a web service that searches for online books by parsing the search results of many book providers’ websites. I could get the raw HTML data of the page, and do some regexs to make the data work for my web service, but if any of the websites change the formatting of the pages, my code breaks!

RSS is indeed a marvelous option, but many sites don’t have an XML/JSON based search.

Are there any kits out there that help disseminate information on pages automatically? A crazy idea would be to have a fuzzy AI module recognize patterns on a search results page, and parse the results accordingly…

  • 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-12T07:15:47+00:00Added an answer on May 12, 2026 at 7:15 am

    I’ve done some of this recently, and here are my experiences.

    There are three basic approaches:

    1. Regular Expressions.
      • Most flexible, easiest to use with loosely-structured info and changing formats.
      • Harder to do structural/tag analysis, but easier to do text matching.
      • Built in validation of data formatting.
      • Harder to maintain than others, because you have to write a regular expression for each pattern you want to use to extract/transform the document
      • Generally slower than 2 and 3.
      • Works well for lists of similarly-formatted items
      • A good regex development/testing tool and some sample pages will help. I’ve got good things to say about RegexBuddy here. Try their demo.
      • I’ve had the most success with this. The flexibility lets you work with nasty, brutish, in-the-wild HTML code.
    2. Convert HTML to XHTML and use XML extraction tools. Clean up HTML, convert it to legal XHTML, and use XPath/XQuery/ X-whatever to query it as XML data.
      • Tools: TagSoup, HTMLTidy, etc
      • Quality of HTML-to-XHML conversion is VERY important, and highly variable.
      • Best solution if data you want is structured by the HTML layout and tags (data in HTML tables, lists, DIV/SPAN groups, etc)
      • Most suitable for getting link structures, nested tables, images, lists, and so forth
      • Should be faster than option 1, but slower than option 3.
      • Works well if content formatting changes/is variable, but document structure/layout does not.
      • If the data isn’t structured by HTML tags, you’re in trouble.
      • Can be used with option 1.
    3. Parser generator (ANTLR, etc) — create a grammar for parsing & analyzing the page.
      • I have not tried this because it was not suitable for my (messy) pages
      • Most suitable if HTML structure is highly structured, very constant, regular, and never changes.
      • Use this if there are easy-to-describe patterns in the document, but they don’t involve HTML tags and involve recursion or complex behaviors
      • Does not require XHTML input
      • FASTEST throughput, generally
      • Big learning curve, but easier to maintain

    I’ve tinkered with web harvest for option 2, but I find their syntax to be kind of weird. Mix of XML and some pseudo-Java scripting language. If you like Java, and like XML-style data extraction (XPath, XQuery) that might be the ticket for you.


    Edit: if you use regular expressions, make sure you use a library with lazy quantifiers and capturing groups! PHP’s older regex libraries lack these, and they’re indispensable for matching data between open/close tags in HTML.

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

Sidebar

Ask A Question

Stats

  • Questions 142k
  • Answers 142k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think that you are right that the answer in… May 12, 2026 at 8:21 am
  • Editorial Team
    Editorial Team added an answer Check out the aurioTouch sample in the iPhone Developer site. May 12, 2026 at 8:21 am
  • Editorial Team
    Editorial Team added an answer In your example, you are specifically trying to mock the… May 12, 2026 at 8:21 am

Related Questions

I'm trying to parse the title tag in an RSS 2.0 feed into three
Suppose someone is editing a HTML form, and their session times out, how can
I use astyle to format my code most of the time, and I love
I am currently working on a project with five other developers and we are
I usually play with elisp code on my scratch buffer. I find it hard

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.