473,385 Members | 1,372 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.

strip out html

Hello

anybody knows how i can strip out the html from a control's innerhtml to show only the relevant text? i.e
<span id="test1" runat="server"><a href="test1.htm">abcde</a><b>blah</b></span

so that on my server side code, somehow i would get "abcde blah"?
thanks!
Nov 18 '05 #1
2 1117
FYI... you wouldn't get "abcde blah" you'd get "abcdeblah"
I dont think there is an auto-way to do this but just look for the > and <
and use the Substring in a recursive function

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"newbie" <an*******@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Hello,

anybody knows how i can strip out the html from a control's innerhtml to show only the relevant text? i.e. <span id="test1" runat="server"><a href="test1.htm">abcde</a><b>blah</b></span>
so that on my server side code, somehow i would get "abcde blah"??
thanks!

Nov 18 '05 #2

"newbie" <an*******@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Hello,

anybody knows how i can strip out the html from a control's innerhtml to show only the relevant text? i.e. <span id="test1" runat="server"><a href="test1.htm">abcde</a><b>blah</b></span>
so that on my server side code, somehow i would get "abcde blah"??
thanks!


Provided it is xhtml compliant (i.e. no unclosed tags and case sensitive),
why not read the contents of each node, with an XmlTextReader? Then
concatenate each node's value using a StringBuilder.

ms-help://MS.NETFrameworkSDK/cpref/html/frlrfSystemXmlXmlTextReaderClassctor
Topic.htm

....and see the example at bottom for how to use the XmlTextReader.

R.
Nov 18 '05 #3

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

Similar topics

8
by: Fazer | last post by:
Hello, I was wondering what would be the easiest way to strip away HTML tags from a string? Or how would I remove everything between < and > also the < , > as well using regex? Thanks for...
16
by: Voetleuce en f?nsievry | last post by:
G'day I have some pages written by a bot and much of the code does not concern the visible content on the site. I'd like to strip all the codes that do not affect or influence the visible stuff...
3
by: Michal A. Valasek | last post by:
Hello, I want to transform text with HTML markup to plain text. Is there some simple way how to do it? I can surely write my own function, which would simply strip everything with < and >....
5
by: vMike | last post by:
Is there any benefit to stripping all the space from the page before rendering by overriding the page render and using the htmltextwriter and stringbuilder to strip linefeeds, tabs and extra space...
2
by: Daniel M. Hendricks | last post by:
I'm looking for a function/regex in C# to strip unwanted HTML tags from comments posted to my web site. Previously, it was written in PHP and I used this function to strip unwanted tags: ...
2
by: tshad | last post by:
Is there an easy way to strip HTML tags from Text to get just the plain text? I am using a program called FreeTextBox that lets you format Text in a TextBox. It does this by adding HTML tags...
4
by: Steve | last post by:
Hi, I'm a complete PHP n00b slowly finding my way around I'm using the following function that I found on php.net to strip out html and return only the text. It works well except for when you...
6
by: eight02645999 | last post by:
hi can someone explain strip() for these : 'example' when i did this: 'abcd,words.words'
6
by: george | last post by:
hello, which is the best way to strip jscript/vbscript from user input? Is there any module I could reuse? thanks in advance george P.S. the solution must allow users to enter html code.
6
by: Christoph Zwerschke | last post by:
In Python programs, you will quite frequently find code like the following for removing a certain prefix from a string: if url.startswith('http://'): url = url Similarly for stripping...
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: 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...

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.