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

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

    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.


  • Yan-Hong Huang[MSFT]

    #2
    RE: How to process HTML pages on server side with HTML DOM?

    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.

    Comment

    • MSFT

      #3
      RE: How to process HTML pages on server side with HTML DOM?

      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.)

      Comment

      • Vince C.

        #4
        Re: How to process HTML pages on server side with HTML DOM?

        "MSFT" <lukezhan@onlin e.microsoft.com > a écrit dans le message de
        news:xqk614D1DH A.1340@cpmsftng xa07.phx.gbl...[color=blue]
        > 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,[/color]

        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..."


        Comment

        • MSFT

          #5
          Re: How to process HTML pages on server side with HTML DOM?

          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.)

          Comment

          • Pete

            #6
            Re: How to process HTML pages on server side with HTML DOM?

            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!

            Comment

            • Vince C.

              #7
              Re: How to process HTML pages on server side with HTML DOM?

              "Pete" <anonymous@devd ex.com> a écrit dans le message de
              news:%23fr0IGR1 DHA.2680@TK2MSF TNGP11.phx.gbl. ..[color=blue]
              > Or, if your html is xml-compliant, you can always use the XML Parser.[/color]

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

              Vince C.


              Comment

              Working...