473,809 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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, IHTMLDOMAttribu te, 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 12705
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=VBS cript CODEPAGE=65001 %>

<%

Dim doc

Set doc = CreateObject("H TMLFILE")

dim objFSO

Set objFSO = Server.CreateOb ject("Scripting .FileSystemObje ct")

dim htmlFile

set htmlFile= objFSO.OpenText File("c:\test.h tml")
doc.write htmlFile.ReadAl l

'doc.body.inner Text="hello world"

Response.Write doc.documentEle ment.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******@onlin e.microsoft.com > a écrit dans le message de
news:xq******** ******@cpmsftng xa07.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=VBS cript CODEPAGE=65001 %>

<%

Dim doc

Set doc = CreateObject("H TMLFILE")

dim objFSO

Set objFSO = Server.CreateOb ject("Scripting .FileSystemObje ct")

dim htmlFile

set htmlFile= objFSO.OpenText File("c:\test.h tml")
doc.write htmlFile.ReadAl l

'doc.body.inner Text="hello world"

Response.Write doc.documentEle ment.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*******@devd ex.com> a écrit dans le message de
news:%2******** ********@TK2MSF TNGP11.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
1029
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 of "submit button" how do I get the value of the HTML Controls? How do you provide a "rich" experience without roundtrips? Can you? What is the prefered way to architect these pages? Any pointers to whitepapers/docs would be apprecieated?
3
13493
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 window automatically. Pls help Sileesh
2
1207
by: dee | last post by:
Hi, I was wondering if server side html controls were used prior to dotnet? Thanks Dee
1
1769
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 UserControl it generate nothing ? Thanks for your help.
6
2871
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 with SQL 2000. All new code is being written in C# using ASP.NET and we are using forms authentication to control access to particular directories/applications. We are having a hard time figuring out how to configure the thing so that existing...
1
1618
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 can't find out how to do--calls a webservice on a separate server... Client ASP server (no .net)
1
1679
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 HTML and then print the HTML (the pretty document - not the code) on the server printer. Any ideas??
5
1522
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 is a slight delay in the process (business rules) between the submit button and the postback. Basically I need the button to be clicked once. Anyhelp will be appreciated
3
1907
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 users could click the links and the content of any selected page would show up immediately, making no requests. So, I have one main page called mainpage.asp which, I think, should get all subpages with content, names are subpage1.asp, subpage2.asp,...
1
1356
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 totally out of my control. I can think of three situations off the top of my head. In one case, it was a login to the client's PeopleSoft system. In another, it was a PayPal form.
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10379
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3014
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.