Hi,
I store the comments as a text in database, but for special characters as an HTML tag.
While fetching it in a text file, i just need the comments and no HTML tag.
Is there any way to remove this using C program.
Pls help.
-Ratish
8 3683
Are you confident the html file is well-formed? If so, you could delete all text enclosed in angle brackets. Notice that horrible things will happen if the input file isn't well-formed.
What are you supposed to do with character entity references (such as "<") and numeric entity references (such as "Σ) -- pass them through or expand them?
Is this an assignment that you have to do in a particular way; or are you happy with any approach that works? Try opening the file with a browser and then saving it as a text file.
Actually the text is stored in database while formatting from the application screen.
But I need to provide a report with the comments input for which I need to remove the html tags. I am using a C program to fetch the data from database.
But it carries the html tags. I need to remove all the HTML tags that is in these comments.
@Ra71sh
Yes, you already wrote that: copy all characters on a line until you scan a '<'; stop copying but keep on scanning until you see a '>'. Repeat until you've reached the end of the line.
As already mentioned character combinations such as '<' and uglier pass unharmed.
kind regards,
Jos
that is fine but my concern is for the cases where someone has entered some text e.g. points where he has used <a>, <b>, or a>, b> etc.
How would I handle this.
Also, in cases where I have special handling like & or #3688 etc what would I do?
@Ra71sh
You have to write a complete fault tolerant html parser then. As a corollary I understand that your database contains incorrect html data? If so the GIGO prinicples rears its ugly head (Garbage In Garbage Out).
kind regards,
Jos
@Ra71sh
In a well-formed html file, the input characters "<" and ">" would be replaced by "<" and ">". Is that happening for you? If not, then your file is malformed and you will have great difficulty parsing it.
Regarding "๨" and its kin, don't ask us ... what do you think should happen? Are you emitting a text file? If so, then you are limited to printable characters. What is a meaningful and useful way to handle nonprintable characters in your context?
Do you want to see the html page exactly as it would appear on a browser page -- with all the mark-ups? If so, then open the file with a browser and save or print to a pdf file.
@donbock
That is so funny. ;-)
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jeff North |
last post by:
Hi,
I'm using a control called HTMLArea which allows a person to enter
text and converts the format instructions to html tags. Most of my
users know nothing about html so this is perfect for my...
|
by: lkrubner |
last post by:
I'd like to write a PHP script to be used from the command line on a
Unix machine. I'd like for the script to put together a string, turn it
into a web page, print it, then return control the...
|
by: John Olsen |
last post by:
Hi.
I`m building a small CMS, and want to add the possibility to include server
side code inside static html-strings that is stored in a database.
For e.g. in the string...
|
by: Alex |
last post by:
Hello.
First, with AJAX I will get a remote web page into a string. Thus, a
string will contain HTML tags and such. I will need to extract text
from one <span> for which I know the ID the inner...
|
by: anupamjain |
last post by:
Hi,
After 2 weeks of search/hit-and-trial I finally thought to revert to
the group to find solution to my problem.(something I should have done
much earlier)
This is the deal :
On a JSP...
|
by: Just D. |
last post by:
All,
What's the simplest way to show my own HTML string on the ASPX page assuming
that this page is just created using the wizard and it has nothing on it?
We're free to use any control adding...
|
by: Xah Lee |
last post by:
Summary: when encountering ex as a unit in css, FireFox (and iCab) did
not take into account the font-family.
Detail:
http://xahlee.org/js/ff_pre_ex.html
Xah
xah@xahlee.org
∑...
|
by: since |
last post by:
I figured I would post my solution to the following.
Resizable column tables.
Search and replace values in a table. (IE only)
Scrollable tables.
Sortable tables.
It is based on a lot...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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
|
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...
|
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: 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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |