473,326 Members | 2,110 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,326 software developers and data experts.

asp innerText?

in DHTML, body.innerText nicely strips out the raw textual contents of a
formatted page. Is there a straighforwards way to do this with a server-side
ASP function (e.g. on a string containing the HTML) ? It is to fill a
database field used for a simple search routine.
I don't have permission on this server to use 3rd party components, it's
plain IIS6.
Thanks.
Giles
Feb 16 '06 #1
5 3751
Giles wrote:
in DHTML, body.innerText nicely strips out the raw textual contents
of a formatted page. Is there a straighforwards way to do this with a
server-side ASP function (e.g. on a string containing the HTML) ? It
is to fill a database field used for a simple search routine.
I don't have permission on this server to use 3rd party components,
it's plain IIS6.


Use a Regular Expression.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Feb 16 '06 #2
from Bob Barrows [MVP]
Giles wrote:
in DHTML, body.innerText nicely strips out the raw textual contents
of a formatted page. Is there a straighforwards way to do this with a
server-side ASP function (e.g. on a string containing the HTML) ? It
is to fill a database field used for a simple search routine.
I don't have permission on this server to use 3rd party components,
it's plain IIS6.


Use a Regular Expression.
Bob Barrows


RegExp is a black art to me! Off the top of the head,
delete from "<head" to "/head>"
delete from "<style" to "/style>" (in case not in head)
delete from "<script" to "/script>" (in case not in head)
replace anything in chevrons with nothing.
replace line-breaks with spaces
replace multiple spaces with single spaces
replace HTML entities with literals
Does that sound about right?
thanks, Giles
Feb 16 '06 #3
Giles wrote:
from Bob Barrows [MVP]
Giles wrote:
in DHTML, body.innerText nicely strips out the raw textual contents
of a formatted page. Is there a straighforwards way to do this with
a server-side ASP function (e.g. on a string containing the HTML) ?
It is to fill a database field used for a simple search routine.
I don't have permission on this server to use 3rd party components,
it's plain IIS6.
Use a Regular Expression.
Bob Barrows


RegExp is a black art to me!

Somewhat to me as well ...
A couple people in this group (Chris Hohmann comes to mind) have it down
pretty well. There are some websites out there that provide libraries of
regular expression patterns.
Off the top of the head,
delete from "<head" to "/head>"
delete from "<style" to "/style>" (in case not in head)
delete from "<script" to "/script>" (in case not in head)
replace anything in chevrons with nothing.
replace line-breaks with spaces
replace multiple spaces with single spaces
replace HTML entities with literals
Does that sound about right?


I guess so, but why are you leaving the closing and opening brackets?
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Feb 16 '06 #4
Giles wrote:
in DHTML, body.innerText nicely strips out the raw textual contents of a
formatted page. Is there a straighforwards way to do this with a server-side
ASP function (e.g. on a string containing the HTML) ? It is to fill a
database field used for a simple search routine.


If you can, you might consider using the Indexing Services instead of
rolling your own search routine.

http://www.codeproject.com/asp/indexserver.asp

If that's not an option, you should be able to use Internet Explorer
from an ASP.

<% Option Explicit

Dim ie: Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "about:blank"

Dim doc: Set doc = ie.Document
doc.open
doc.writeln "<dl>"
doc.writeln "<dt>em</dt>"
doc.writeln "<dd>Indicates <em>emphasis</em></dd>"
doc.writeln "<dt>strong</dt>"
doc.writeln "<dd>Indicates <strong>stronger emphasis</strong></dd>"
doc.writeln "</dl>"
doc.close

Response.ContentType = "text/plain"
Response.Write doc.documentElement.InnerText
%>
Feb 16 '06 #5
"Giles" <gi***@nospam.com> wrote in message
news:eu**************@TK2MSFTNGP10.phx.gbl...
in DHTML, body.innerText nicely strips out the raw textual contents of a
formatted page. Is there a straighforwards way to do this with a
server-side ASP function (e.g. on a string containing the HTML) ? It is to
fill a database field used for a simple search routine.
I don't have permission on this server to use 3rd party components, it's
plain IIS6.


With ASP you have complete control over the content of the page before it
gets written so it's not clear to me why you would need to do this ...

--
Tom Kaminski IIS MVP
http://www.microsoft.com/windowsserv...y/centers/iis/
http://mvp.support.microsoft.com/
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
Feb 17 '06 #6

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

Similar topics

13
by: Jeff | last post by:
Hi! I'm trying to update a number in a document with the following code. It displays a number, a div block with a minus sign and a div block with a plus sign. When I click the plus sign I want...
2
by: oembuilders | last post by:
Having a bit of trouble figuring out how to get the innerText of a cell other that the one selected. Any help would be apprecated as I am very new to javascript. I got the working example from...
2
by: delraydog | last post by:
I know that innerText is not supported in FireFox and I've found the following code fragment which was originally designed in an HTMLElement prototype for an innerText getter. I do not however want...
6
by: C# newbie | last post by:
Hello group, When I run an XPATH query first as: //*[contains(translate(.,\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\", \"abcdefghijklmnopqrstuvwxyz\")
6
by: martin | last post by:
Hi, I would like to write the text of an element to an xml doc as that it look like this <Address>&quot;Marty Jones&quot; &lt;mj@mydomain.com&gt;</Address> however I can't seen to get the quote marks to...
13
by: Lyners | last post by:
I have a web page writen in ASP.NET that contains some javascript so that when a user presses a button, or edits a certain field in a datagrid, another cell in the datagrid is filled with a value....
10
by: Angel | last post by:
I want to concat a space in an HTML Control's innerText property. here is a sample code Dim celCreate As New HtmlControls.HtmlTableCell() celCreate.innerText = " TEST" When the page is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.