473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

HTML::Parser to parse a HTML file from URL or standalone

Hi,
I want to use HTML::Parser to parse a HTML file. My problem is that the html file can be from a URL or it can be a local file. How do I do this?
Aug 15 '07 #1
4 1826
KevinADC
4,059 Expert 2GB
Isn't that covered in the HTML::Parser documentation?
Aug 16 '07 #2
Maybe my question is not clear. In my application what happens is that sometimes the html file to be parsed comes from a URL and sometimes the html file is stored locally in a directory and the app is directed to read the html file from that directory. Yes HTML::Parser can do both, but you have to use two different functions. I was looking to see if there was way to parse either file using one function call. The documentation does not list any function that I am looking for. Any more information is appriciated.
Aug 16 '07 #3
KevinADC
4,059 Expert 2GB
As far as I understand your question, the answer is: no. Getting files over the net from a URL is totally different than reading a local file from a local directory, there is no one function I know of that does both.
Aug 16 '07 #4
Thank you for your reply. I figured out that there is no one function that will do both. So what I am doing is that when I call the perl script the first argument is the url or html file name and second argument is "URL" for url and "local" for html file and then in the code for URL I use the get function and for local I use parse_file function.

-Rajesh
Aug 20 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Mitchua | last post by:
I am trying to use HTML::Parser to parse an HTML file, remove all HTML tags (including comments, etc.), replace all ENTITIES (e.g. &amp), and put the result into a variable as a string. I figure...
0
by: Himanshu Garg | last post by:
Hello, I am using HTML::Parser to extract text from html pages from http://bbc.co.uk/urdu/ However the encoding of the input text seems to change to some unknown encoding in the output. The...
2
by: Divya Rao | last post by:
Hi, I need to parse a HTML file, and extract all the text in it (not the images, tags). I cannot figure out how to do it. I have the HTML file saved in my local directory. I need to have the text...
14
by: WUV999U | last post by:
Hi I am fairly familiar in C but not much. I want to know how I can write a html parser in C that only parses for the image file in the html file and display or print all the images found in...
7
by: majid | last post by:
I want write a program with c# to pars a html file how ccan i do this with system.mshtml? or there is other way to do it p;ease help me?
0
by: icoba | last post by:
Hi, I am parsing html documents using the html parser from libxml2, and if the encoding is included in the document it works perfectly but if it is not, I think it does not work well (probably...
3
by: SEGACO | last post by:
Hi, Can someone tell me if C# includes something to parse HTML? Thanks.
1
by: atulskulkarni | last post by:
Hello All, I am trying to extract text from the HTML using the following code, use strict; use HTML::Parser 3.00 (); my %inside; my $p;
5
by: Johannes Bauer | last post by:
Hello group, I'm trying to use a htmllib.HTMLParser derivate class to parse a website which I fetched via httplib.HTTPConnection().request().getresponse().read(). Now the problem is: As soon as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.