Hi!
If I want to parse this html file (e.g. copy it into an other file using HTML Parser) I only get an empty file.
What am I doing wrong?
Thank you for your answer in advance.
Gábor
5 2259
I forgot to mention that if I am working with a much simpler file e.g. an HTML file that has only 5 or 6 rows then everything is fine.
Gábor
KevinADC 4,059
Recognized Expert Specialist
See where my finger is pointing? That is where you are making a mistake.
eWish 971
Recognized Expert Contributor
Showing use the code would result in KevinADC not having to use his fingers.
--Kevin
Hello,
This is the code I used: - #!/usr/bin/perl -w
-
-
use strict;
-
-
-
# define the subclass
-
package IdentityParse;
-
use base "HTML::Parser";
-
-
open(OUT,">placid.html");
-
-
sub text {
-
my ($self, $text) = @_;
-
# just print out the original text
-
print OUT $text;
-
}
-
-
#sub comment {
-
# my ($self, $comment) = @_;
-
# # print out original text with comment marker
-
# print OUT "";
-
# }
-
-
sub start {
-
my ($self, $tag, $attr, $attrseq, $origtext) = @_;
-
# print out original text
-
print OUT $origtext;
-
}
-
-
sub end {
-
my ($self, $tag, $origtext) = @_;
-
# print out original text
-
print OUT $origtext;
-
}
-
my $p = new IdentityParse;
-
$p->parse_file("index.html");
-
Thank you for your help in advance:
Gábor
Hello Guys,
It was all my mistake. The file's name I wanted to parse was x.htm and not x.html.
Sorry for bothering the forum.
I am new to perl I thought that there is a much complex problem.
Sorry again.
Gábor
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Fred Ma |
last post by:
Hello,
This is not a troll posting, and I've refrained from
asking because I've seen similar threads get all
nitter-nattery. But I really want to make a decision
on how best to invest my time. I'm not interested on
which language is better in *general*, just for my
purpose. My area of research is in CAD algorithms,
and I'm sensing the need to resort to something more
expedient than C++, bash scripting, or sed scripting.
|
by: Neal |
last post by:
I need to know how to pass a parameter from PERL to an XSLT when using
that XSLT to transform XML. For instance, I'd like to pass a paramter
that I retrieve from the queryString and pass it into XSLT which will
create my HTML.
Here's what I have for the basic transformation:
#!/usr/local/bin/perl
use XML::XSLT;/
|
by: Jesse Thompson |
last post by:
Greetings fell XML folk.
I've just gotten started making SAX filters in Perl. I was hoping to
build an XML templating engine this way, but the performance of
XML::SAX::Expat and XML::SAX::Writer *appear* to be unthinkably bad.
This code:
XML::SAX::Expat->new(Handler => XML::SAX::Writer->new( Output => '>-'
))->parse_uri("test.xml");
|
by: zzapper |
last post by:
Hi am XML newbie
This is the XML that is returned from a distant server, I can process
it with standard Perl to get the data I want, but I know I ought to be
able to use a Perl Module such as XML::Simple to dump into a Perl
structure automatically, except I can't get it to work.
My xml data is in
$xml= $ua->request($req)->as_string;
|
by: Bob MacBob |
last post by:
Hi all,
I have two scripts:
1/ parser.pl which parses a text file and stuffs the relevant data into a
mySQL DB - works fine no probs there
2/ importer.pl which I want to run through all the relevant files in a
directory and run them through parser.pl
| |
by: Kirt Loki Dankmyer |
last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile
it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of
different switches, but I can't get it to compile. I need it to be
compiled with threads.
Anyone have any wisdom on how best to do this?
Here's a transcript of my latest attempt. It's long; you might want to
skip to the bottom, where I try "make" and the fatal errors start
happening.
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
|
by: bhavanirayala |
last post by:
Hello,
I am using XML::Parsar in my perl file.
but when I run the perl file, getting the following erro even I have the parser.pm and Dynaloader.pm files in the lib path.
The error is:
Can't load '/usr/local/lib/perl5/site_perl/5.6.1/aix/auto/XML/Parser/Expat/Expat.so' for module XML::Parser::Expat: dlopen: /usr/local/lib/perl5/site_perl/5.6.1/aix/auto/XML/Parser/Expat/Expat.so: A file or directory in the path name does not exist. at...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script.
What You Need
Any recent...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |