Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: So Simple, Yet no tutorial covers it

by MeowChow (Vicar)
on Jan 22, 2001 at 01:15 UTC ( [id://53377]=note: print w/replies, xml ) Need Help??


in reply to Re: So Simple, Yet no tutorial covers it
in thread So Simple, Yet no tutorial covers it

You would use HTML::Parser or HTML::TokeParser.

I have to disagree with this bit of advice. Using a fully-fledged HTML parser, IMO, usually does not help in extracting structured data from an html page. Parsing and extracting the markup often adds an unneeded layer of complexity to the task, and offers little in the way of additional "resiliance" to changes in page design/layout (one can reasonably argue that parsing markup results in more sensitivity to such changes).

I agree that parsing html with regex is a bad idea, but it is not the html that one is generally interested in. The html says little or nothing about the structure of the data inside the document. If the document in question is script-generated, I suggest that you simply grab the data using whatever sensible regex you can come up with, and don't mess with parsing the html out of it.

  • Comment on Re: Re: So Simple, Yet no tutorial covers it

Replies are listed 'Best First'.
Re: Re: Re: So Simple, Yet no tutorial covers it
by chromatic (Archbishop) on Jan 22, 2001 at 09:17 UTC
    If the problem domain were no more complex than the original poster's example, I personally wouldn't use HTML::Parser either.

    It's always hard to gauge the knowledge level of a poster, and it's tempting to assume that people can walk the fine line between hand-rolling a simple, one-shot solution and not painting yourself into a corner.

    I'd rather give a beginning programmer another tool to use than recommending a tricky use of an existing tool.

    Different approach, judgment call on the part of anyone who answers the question. (If more people used HTML markup to express semantic divisions of a document, parsing would certainly be more useful).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://53377]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-25 07:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found