HtmlEditor :  Phorum 5 The fastest message board... ever.

This is the discussion forum for the HtmlEditor. See also the HtmlEditor home page, where you can download the control, and the Documentation Wiki, a collaborative project for documenting the control.

Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
Getting the document source
Posted by: Arun Bhalla (---.vp.uiuc.edu)
Date: Tuesday, 22-Apr-2003, 03:08:09

Hi,

I noticed the GetDocumentSource() utility function in HTMLEditor. Is there really no better way to get the HTML source of a document? It strikes me as somewhat odd that it wouldn't be more standardized.

Thanks,
Arun

Re: Getting the document source
Posted by: Tim Anderson (---.server.ntl.com)
Date: Tuesday, 22-Apr-2003, 06:10:34

Do you mean the way it is wrapped by the control, or the underlying technique?

You can certainly wrap it in different ways, you have the source :-)

As to the technique used, there are other ways. For example, you can use the DOM to read the body.innerHTML. I don't like it as much because you don't get the entire source (with headers); and because in some circumstances you don't get current source but an old version (the document as loaded). Even GetDocumentSource() is not perfect in this respect, but it is OK in edit mode and generally better behaved.

Tim

Re: Getting the document source
Posted by: Arun Bhalla (---.vp.uiuc.edu)
Date: Tuesday, 22-Apr-2003, 06:47:34

Hmm, well, I'm talking about the technique since I have HTMLDocument objects that I'm working with in my project.

I don't have the source since I send MSHTML off to get the document with createDocumentFromUrl(). I'm using MSHTML for downloading and parsing documents, not for editing, but it turns out that I also need the complete page source now.

doc.body.innerHTML is okay, but like you said, it lacks the headers. I tried ((IHTMLElement)doc).innerHTML and/or doc.document.innerHTML, and I think they weren't implemented.

I also fear that innerHTML has to do a lot more computation (building strings) rather than returning a stored string. But a way of getting the document source for an HTMLDocument that doesn't enter design/edit mode is what I'm looking for.

Thanks,
Arun

Re: Getting the document source
Posted by: Tim Anderson (---.server.ntl.com)
Date: Tuesday, 22-Apr-2003, 07:21:01

In that case utils.GetDocumentSource should work OK.

Tim



Your Name: 
Your Email: 
Subject: 
Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically.
m3NTe
This is a moderated forum. Your message will remain hidden until it has been approved by a moderator or administrator
This forum powered by Phorum.