construct HTMLDocument

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kavitha

    #1

    construct HTMLDocument

    Can we construct a HTMLDocument? I mean something like
    this

    string outerHTML = "<HTML><BODY>So me sample
    text...</BODY></HTML>";
    HTMLDocument doc = new HTMLDocument();
    doc.addElement( "HTML");
    doc.all.item("H TML", 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 createDocumentF romUri
    () 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

  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: construct HTMLDocument

    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]
    - nicholas.paldin o@exisconsultin g.com

    "kavitha" <kavitha.raprol u@megasoft.com> wrote in message
    news:06d401c347 86$2c04aec0$a50 1280a@phx.gbl.. .[color=blue]
    > Can we construct a HTMLDocument? I mean something like
    > this
    >
    > string outerHTML = "<HTML><BODY>So me sample
    > text...</BODY></HTML>";
    > HTMLDocument doc = new HTMLDocument();
    > doc.addElement( "HTML");
    > doc.all.item("H TML", 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 createDocumentF romUri
    > () 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
    >[/color]


    Comment

    Working...