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

How to process HTML pages on server side with HTML DOM?

Hi.

I'd like to process HTML documents in an ASP script, i.e. to remove any unwanted
elements and extract desired element and attributes. I know how to do it on
client side within IE using its HTML DOM. But what I'd like is to do it
server-side. Is there a way, for instance, to reuse MSIE technology to retrieve
interfaces like IHTMLElement, IHTMLDOMAttribute, aso, or just built-in features
that would allow me to do the same?

Thanks or any hint/suggestion.

Vince C.
Jul 19 '05 #1
6 12671
Hi Vince,

Thanks for posting in the group.

Currently I am finding somebody who could help you on it. We will get back
here with more information as soon as possible. If you have any more
concerns, please feel free to post here.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 19 '05 #2
Hi Vince,

As I understabd, you want to parse the DOM element for a HTML file in ASP
server script. To achieve this, we may read the HTML file with FSO and Load
it in a HTMLDocument object, for example:

<%@Language=VBScript CODEPAGE=65001 %>

<%

Dim doc

Set doc = CreateObject("HTMLFILE")

dim objFSO

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

dim htmlFile

set htmlFile= objFSO.OpenTextFile("c:\test.html")
doc.write htmlFile.ReadAll

'doc.body.innerText="hello world"

Response.Write doc.documentElement.outerHTML

%>

Hope this answer your question,

Regards,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 19 '05 #3
"MSFT" <lu******@online.microsoft.com> a écrit dans le message de
news:xq**************@cpmsftngxa07.phx.gbl...
Hi Vince,

As I understabd, you want to parse the DOM element for a HTML file in ASP
server script. To achieve this, we may read the HTML file with FSO and Load
it in a HTMLDocument object, for example:

<%@Language=VBScript CODEPAGE=65001 %>

<%

Dim doc

Set doc = CreateObject("HTMLFILE")

dim objFSO

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

dim htmlFile

set htmlFile= objFSO.OpenTextFile("c:\test.html")
doc.write htmlFile.ReadAll

'doc.body.innerText="hello world"

Response.Write doc.documentElement.outerHTML

%>

Hope this answer your question,


Oh my! I never thought it was so simple! Knocks one's socks off... It was worth
asking the question before reinventing the wheel.

Not even threading nor performance issues apart from those that relate to using
FSO? Note you don't need to say "yes" as I'm already satisfied ;-).

Vince C.
"- Use the forge, Luke..."
Jul 19 '05 #4
Hi Vince,

For frequently requested web page, we need to consider the performance for
FSO. Anyway, FSO is the common way we use in ASP to read a file.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jul 19 '05 #5
Or, if your html is xml-compliant, you can always use the XML Parser.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #6
"Pete" <an*******@devdex.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP11.phx.gbl...
Or, if your html is xml-compliant, you can always use the XML Parser.


That's my problem: it's not. Because modified (for now) by non XHTML-aware
Office tools.

Vince C.
Jul 19 '05 #7

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

Similar topics

1
by: eNathan | last post by:
I want to be able to disable\enable controls on the client via client-side scripting. I'm trying to avoid a postback. I'd like to use HTML and server-side controls on the same page. In code-behind...
3
by: Sileesh | last post by:
Hi I hope some one has an answer to this. I have a button in an aspx page . On server click of this button, i perform some operation. Once the operation is performed i want to close this...
2
by: dee | last post by:
Hi, I was wondering if server side html controls were used prior to dotnet? Thanks Dee
1
by: rabii.mail | last post by:
Hello, I've developped simple UserControl and I wanna to get generated html in server side. I've tested that using WebControl (RenderContent) and it works well. But, when I try to do that with my...
6
by: William F. Zachmann | last post by:
We've got a project going that involves moving an old web site with a massive dll written in C++ that produces most of the output from a SQL 7.0 data base on NT4 onto IIS on Windows 2003 Server...
1
by: Mr Bojangles | last post by:
Hi, I want a do the following: From a (client side) web form, post to server side script (I'm using Javascript but anything will do), which in turn--and this is the important bit that I...
1
by: sprash25 | last post by:
Hi, I am using a rich text editor (FCKEdit) on a webpage in which user can enter formatted text. The output of this control is HTML. Now on the code behind side, I need to change some of this...
5
by: Shaqman | last post by:
I have a server side asp button that submits a form after completion and a postback to acknowledgement. I need to disable the button after the user clicks on this once to prevent duplication. There...
3
by: vunet.us | last post by:
Hello, I am breaking my head running out of ideas about the best solution to my goal. I want to load some pages generated with the server (ASP) and assign their html results to JavaScript, so...
1
by: Deane | last post by:
I've run into this problem on many occasions -- I need to have the server side form tag on my Web form, of course. But I also need to have *another* form on the page that posts to a URL...
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
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
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...

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.