469,294 Members | 1,701 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,294 developers. It's quick & easy.

Html tag removing but keeping <a href tag

By using Formatter.pm in perl we can remove all html tags. But I want to keep tag <a href and remove all other tags. Can any body help me to change Formatter.pm file to do this task.

Expand|Select|Wrap|Line Numbers
  1. sub a_start
  2. {
  3.     #shift->{anchor}++;
  4.     #1;
  5. }
  6.  
  7. sub a_end
  8. {
  9.     #shift->{anchor}--;
  10. }
Feb 6 '08 #1
3 2163
numberwhun
3,503 Expert Mod 2GB
By using Formatter.pm in perl we can remove all html tags. But I want to keep tag <a href and remove all other tags. Can any body help me to change Formatter.pm file to do this task.

Expand|Select|Wrap|Line Numbers
  1. sub a_start
  2. {
  3.     #shift->{anchor}++;
  4.     #1;
  5. }
  6.  
  7. sub a_end
  8. {
  9.     #shift->{anchor}--;
  10. }
Just out of curiosity, is this a module that you or someone else you know, wrote? The only "Formatter" module I see is for report generation via a DBI query. There is nothing about HTML in it. If it is a specific module from CPAN, which one is it?

If it is your own, home grown module, then we don't have any clue what the code looks like or does.

Regards,

Jeff
Feb 6 '08 #2
Just out of curiosity, is this a module that you or someone else you know, wrote? The only "Formatter" module I see is for report generation via a DBI query. There is nothing about HTML in it. If it is a specific module from CPAN, which one is it?

If it is your own, home grown module, then we don't have any clue what the code looks like or does.

Regards,

Jeff
I have writtern all detail about this module i n your private messages box. It is actually CPAN module and also used for removing or some partially removing html tags from html file. Waiting for your response.
Regards

ALI
Feb 8 '08 #3
Title : yes it is CPAN Module Version: 2.04
--------------------------------------------------------------------------------
http://search.cpan.org/~sburke/HTML-...L/Formatter.pm

Aforementioned is the link of the CPAN formatter.pm file. When we use Formatter.pm and FormatText.pm files it removes all the Html tags present in Html file. What I want is to remove all the tags but keeping the tags which starts with <a href .

So following is a part of that formatter.pm file code we have to change to keep <a href tags by leaving all the code in Formatter.pm file as it is.
Expand|Select|Wrap|Line Numbers
  1. sub a_start
  2. {
  3.     shift->{anchor}++;
  4.     1;
  5. }
  6.  
  7. sub a_end
  8. {
  9.     shift->{anchor}--;
  10. }
  11.  
I have tried to change it but I am not good in writing code in perl so I cant do so.

Because you are expert and I am sure you can do it in very short time. This is why I need your help.

If you still have any question related to it please email me XXXXXXXXXX
I am waiting for you warm response.
Feb 8 '08 #4

Post your reply

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

Similar topics

2 posts views Thread by Gregor Horvath | last post: by
2 posts views Thread by Donald Firesmith | last post: by
2 posts views Thread by Raja Kannan | last post: by
26 posts views Thread by webrod | last post: by
3 posts views Thread by Jason7899 | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.