473,385 Members | 1,642 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,385 software developers and data experts.

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 2244
numberwhun
3,509 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

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

Similar topics

2
by: Gregor Horvath | last post by:
Hi, Before I reinvent the wheel I`d like to ask if someone has done this before since I did not find an advice at Google. The goal is to create a dynamic Tree View in HTML. Say I have a...
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
2
by: Raja Kannan | last post by:
Is there a way to remove text portion from the HTML keeping the HTML Tags using the browser, say javascript RegEx or something ? I have seen lot of examples removing HTML tags to get the text...
2
by: bissatch | last post by:
Hi, I am currently writing a simple PHP program that uses an XML file to output rows for a 'Whats New' page. Once written, I will only require updating the XML file and any pages that use the...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
7
by: mark | last post by:
Hi All, Apologies for the newbie question but I've searched and tried all sorts for a few days and I'm pulling my hair out ; Please feel free to teach me to suck eggs because it's all new to me...
1
by: John | last post by:
Hi var poster="<html><head..... etc .... </html>"; var animal='dog'; The string contains images and text that changes. Originally I wanted to do something like print "<a href=" +...
26
by: webrod | last post by:
Hi, I have some php pages with a lot of HTML code. I am looking for a HTML validator tool (like TIDY). TIDY is not good enough with PHP tags (it removes a lot of php code). Do you have any...
3
by: Jason7899 | last post by:
Hello Everyone, I have been searching tirelessly and cannot find a way to convert this text into html text= &amp;lt;p&amp;gt;LONDRES (Reuters) - Cientistas descobriram tr&amp;ecirc;s importantes...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.