HTML Import and Parse

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

    #1

    HTML Import and Parse

    I admit that I am a novice when it comes to the HTML DOM and
    JavaScript. Basically, here is what I want to do:

    1. Import some HTML from a remote web site
    2. Parse the HTML to locate a specific tag based on font weight and
    font size
    3. Check the text in that tag to see if it matches a specified string

    Does anyone have any ideas?
  • Vincent van Beveren

    #2
    Re: HTML Import and Parse

    > I admit that I am a novice when it comes to the HTML DOM and[color=blue]
    > JavaScript. Basically, here is what I want to do:
    >
    > 1. Import some HTML from a remote web site
    > 2. Parse the HTML to locate a specific tag based on font weight and
    > font size
    > 3. Check the text in that tag to see if it matches a specified string
    >
    > Does anyone have any ideas?[/color]

    You can't do that in JavaScript because of security restrictions.
    You'll need to use some server-side technology for that.

    - Use PHP to parse
    - Use the proxy module in apache to 'proxy' that page to your webserver
    so you can read it
    - Java/JSP/Servlets. java has an API to parse HTML pages
    - ASP ... i'm sure it can be done in here

    Good luck,
    Vincnet





    Comment

    • Randy Webb

      #3
      Re: HTML Import and Parse

      Vincent van Beveren wrote:
      [color=blue][color=green]
      > > I admit that I am a novice when it comes to the HTML DOM and
      > > JavaScript. Basically, here is what I want to do:
      > >
      > > 1. Import some HTML from a remote web site
      > > 2. Parse the HTML to locate a specific tag based on font weight and
      > > font size
      > > 3. Check the text in that tag to see if it matches a specified string
      > >
      > > Does anyone have any ideas?[/color]
      >
      > You can't do that in JavaScript because of security restrictions.[/color]

      In IE and Mozilla, sure I can.


      [color=blue]
      > You'll need to use some server-side technology for that.[/color]

      Depends on the browser actually. And whether it has a JVM installed or
      not. And, whether it has javascript enabled or not.


      --
      Randy
      Chance Favors The Prepared Mind
      comp.lang.javas cript FAQ - http://jibbering.com/faq/

      Comment

      • Grant Wagner

        #4
        Re: HTML Import and Parse

        Randy Webb wrote:
        [color=blue]
        > Vincent van Beveren wrote:
        >[color=green][color=darkred]
        > > > I admit that I am a novice when it comes to the HTML DOM and
        > > > JavaScript. Basically, here is what I want to do:
        > > >
        > > > 1. Import some HTML from a remote web site
        > > > 2. Parse the HTML to locate a specific tag based on font weight and
        > > > font size
        > > > 3. Check the text in that tag to see if it matches a specified string
        > > >
        > > > Does anyone have any ideas?[/color]
        > >
        > > You can't do that in JavaScript because of security restrictions.[/color]
        >
        > In IE and Mozilla, sure I can.
        >
        > http://jibbering.com/2002/4/httprequest.html[/color]

        HTTPRequest won't read from a site other then the site the file it is included
        on was downloaded from in the default security environment.

        In other words, your site can't make a request from www.yahoo.com with the
        HTTPRequest object in the default security environment.
        [color=blue][color=green]
        > > You'll need to use some server-side technology for that.[/color]
        >
        > Depends on the browser actually. And whether it has a JVM installed or
        > not. And, whether it has javascript enabled or not.[/color]

        Applets running the sandbox in the default security environment can't access
        domains other then the one they are downloaded from, Javascript running in the
        default security environment can't make HTTPRequests from domains other then
        the one they were downloaded from.

        If you have a test site that demonstrates otherwise I'd be interested to see
        how you are getting around these security limitations.

        --
        | Grant Wagner <gwagner@agrico reunited.com>

        * Client-side Javascript and Netscape 4 DOM Reference available at:
        *


        * Internet Explorer DOM Reference available at:
        *
        http://msdn.microsoft.com/workshop/a...ence_entry.asp

        * Netscape 6/7 DOM Reference available at:
        * http://www.mozilla.org/docs/dom/domref/
        * Tips for upgrading JavaScript for Netscape 7 / Mozilla
        * http://www.mozilla.org/docs/web-deve...upgrade_2.html


        Comment

        Working...