By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,668 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,668 IT Pros & Developers. It's quick & easy.

construct HTMLDocument

P: n/a
Can we construct a HTMLDocument? I mean something like
this

string outerHTML = "<HTML><BODY>Some sample
text...</BODY></HTML>";
HTMLDocument doc = new HTMLDocument();
doc.addElement("HTML");
doc.all.item("HTML", 0).outerHTML = outerHTML;

Actually I have a url, I need to build a HTMLDocument
from the source of that url. Is there any method o build
a HTMLDocument from url. I tried the createDocumentFromUri
() method of HTMLDocument class, but it is throwing an
exception with message access denied, the url
being "http://localhost/test/test.html"

Can anybody throw some light on this?

Kavitha

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Kavitha,

What you want to do is use the HTMLDocument class, which you need to
access through COM interop. Once you have that, you can access the DOM and
add elements as you wish. To load the url, I would just load the contents
from a file (or use a moniker, if you want to try that).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"kavitha" <ka*************@megasoft.com> wrote in message
news:06****************************@phx.gbl...
Can we construct a HTMLDocument? I mean something like
this

string outerHTML = "<HTML><BODY>Some sample
text...</BODY></HTML>";
HTMLDocument doc = new HTMLDocument();
doc.addElement("HTML");
doc.all.item("HTML", 0).outerHTML = outerHTML;

Actually I have a url, I need to build a HTMLDocument
from the source of that url. Is there any method o build
a HTMLDocument from url. I tried the createDocumentFromUri
() method of HTMLDocument class, but it is throwing an
exception with message access denied, the url
being "http://localhost/test/test.html"

Can anybody throw some light on this?

Kavitha

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.