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

Containing ANY data in a table cell.

I am truncating data from an SQL database and have a script that populates a
cell. The problem that I have is I have HTML tags in my database so if the
data gets truncated in the middle of a tag, then my page goes...well, you
know. What I am looking for is a way that I can contain ANY data (i.e.
characters, tags, etc.) directly in that cell. So...If I have a <table> tag
it will not throw off the rest of the table tags throughout my page.

Please, any idea would be appreciated.

Thanks,

Joe
Jul 20 '05 #1
1 1837

"Joe Conlin" <jo*@bellyusa.com> wrote in message
news:dh***********************@twister2.starband.n et...
I am truncating data from an SQL database and have a script that populates a cell. The problem that I have is I have HTML tags in my database so if the
data gets truncated in the middle of a tag, then my page goes...well, you
know. What I am looking for is a way that I can contain ANY data (i.e.
characters, tags, etc.) directly in that cell. So...If I have a <table> tag it will not throw off the rest of the table tags throughout my page.


I can think of two different things you might have in mind:

1. You want the data to be treated as actual HTML inside the table cell. For
example, if your data (after truncation) were:

This is the <em>last</em> time that I will ever trav

then you would want this string to be displayed with the word "last"
italicized (assuming that is how the browser handles <em>), and without
explicitly displaying the <em> and </em> tags.

2. You want to display HTML tags from the data literally. Using the sample
string above, you would want to display, literally,

This is the <em>last</em> time that I will ever trav

with explicit tags, and without any change in the appearance of the word
"last".

In the latter case, you're escaping your data anyway, replacing < with &lt;
and > with &gt;. Once you've done that, there's no problem: it won't matter
whether the truncation occurs between opening and closing tags, or within a
tag.

In the former case, I think you're out of luck. Depending on whether there
are any restrictions on the tags you permit to be stored in the data in the
first place, your problems may go beyond the ones you mentioned. What if the
data includes tags that can't appear inside a TD, like <head> or <title> or
<body>? What if there's an <img> tag whose source is a relative URL that has
no meaning from the perspective of your web site? Unless you develop some
extraordinarily sophisticated code to reduce your data to something that can
appear properly inside a TD, as well as accounting for and filling in
missing end tags and even missing tag *parts*, you're going to have trouble.

The only practical solution I can think of is to filter out *all* tags and
just display plain text. (In that case, you would probably filter first,
then truncate.) This is what search engines do when they display excerpts
from pages that match your query.

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: christian9997 | last post by:
Hi I was trying to create a page where a SubMenu would appear when the user moved the mouse over an item of a Menu (= Table Cell <TD>). Unfortunately there seems to be a problem; the onMouseOver...
10
by: Andrew Thompson | last post by:
http://www.physci.org/test/chem/element.html, represents information on a chemical element. (http://www.physci.org/test/chem/ for the CSS's) Not yet coded for links to other forms of the...
1
by: Uthuras | last post by:
Greetings, Machine : Pentium IV Os Windows 2000 server Product : DB2 UDB Release : 7.2 We are fail to load the following data file format into db2 database table that has long varchar...
0
by: Pat Sagaser via .NET 247 | last post by:
I'm trying to add LinkButtons to a Repeater control using adynamic template. The docs state that you should be able tobubble the click event to the containing Repeater. There areplenty of examples in...
2
by: John A Grandy | last post by:
anyone know why this is ? Imports System.Data Imports System.Diagnostics Public Class WebForm12
4
by: toby989 | last post by:
Hi All Anyone came across this problem before? I have an X<L file created by excel <xml id="model"> <root> <Row>
10
by: Frank van Wensveen | last post by:
Friend, coders, fellow wage slaves, lend my your ears. I believe that in a perfect world the design of a website (or feature on a website) should be totally separated from its design and the data...
7
by: Mariusf | last post by:
I am a novice Perl programmer and need to change a perl script that I use to create web pages with thumbnail images and some text. Currently the script created a web page for each artist / category...
6
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1)...
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: 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:
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?
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...
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
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...

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.