Converting textbox contents to xml

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

    #1

    Converting textbox contents to xml

    Problem:
    I need to copy the contents of another website into a textarea
    (actually a HTMLArea textarea that retains all of the html code) on to
    my webpage. Then I need to extract certain parts of this page for my
    database. From this copy/paste action I would like to walk through the
    copied data. The trouble is that it is only data. I need to convert
    this data to XHTML format. Is there a method (either server-side or
    client-side) that will allow me to do this?

    Just to add to the problem. I've looked at the code and it is not
    xhtml compliant code (they don't close off a lot of their tags i.e.
    <P> missing closing </P> tag). Will this cause problems with the
    conversion?

    I've looked at XMLHTMLREQUEST option but this appears to work only on
    the same domain - or have I got this totally wrong?

    Reason:
    the site I need to copy the data from wants to charge an exorbitant
    annual fee. The problem is that a) my department doesn't have the cash
    and b) we don't know if this project is going to receive funding to
    continue.

    Any help would greatly appreciated
    ---------------------------------------------------------------
    jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
    ---------------------------------------------------------------
  • Richard Cornford

    #2
    Re: Converting textbox contents to xml

    Jeff North wrote:
    <snip>[color=blue]
    > Reason:
    > the site I need to copy the data from wants to charge an
    > exorbitant annual fee. The problem is that a) my department
    > doesn't have the cash and b) we don't know if this project
    > is going to receive funding to continue.
    >
    > Any help would greatly appreciated[/color]

    I don't know how it works in your part of the world but here assisting
    you in the theft of some third party's intellectual property would be
    illegal in itself, no matter how much you might appreciate it.

    Richard.


    Comment

    • Jeff North

      #3
      Re: Converting textbox contents to xml

      On Sat, 16 Apr 2005 21:55:01 +0100, in comp.lang.javas cript "Richard
      Cornford" <Richard@litote s.demon.co.uk> wrote:
      [color=blue]
      >| Jeff North wrote:
      >| <snip>
      >| > Reason:
      >| > the site I need to copy the data from wants to charge an
      >| > exorbitant annual fee. The problem is that a) my department
      >| > doesn't have the cash and b) we don't know if this project
      >| > is going to receive funding to continue.
      >| >
      >| > Any help would greatly appreciated
      >|
      >| I don't know how it works in your part of the world but here assisting
      >| you in the theft of some third party's intellectual property would be
      >| illegal in itself, no matter how much you might appreciate it.[/color]

      That's right, jump to the wrong conclusions.
      FYI, it is the same government department - just different sections.
      FYI, *I* do have legal access to this data, in fact the first
      department *demands* that I do access *their* data. At a later date,
      when funding is guaranteed, then I will pay the necessary fee but in
      the meantime I have to make do without.
      ---------------------------------------------------------------
      jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
      ---------------------------------------------------------------

      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: Converting textbox contents to xml

        Jeff North wrote:
        [color=blue]
        > I need to copy the contents of another website into a textarea
        > (actually a HTMLArea textarea that retains all of the html code) on to
        > my webpage. Then I need to extract certain parts of this page for my
        > database. From this copy/paste action I would like to walk through the
        > copied data. The trouble is that it is only data. I need to convert
        > this data to XHTML format. Is there a method (either server-side or
        > client-side) that will allow me to do this?[/color]

        Use XMLHttpRequest and then an XMLParser object to parse what is served.
        [color=blue]
        > Just to add to the problem. I've looked at the code and it is not
        > xhtml compliant code (they don't close off a lot of their tags i.e.
        > <P> missing closing </P> tag). Will this cause problems with the
        > conversion?
        >
        > I've looked at XMLHTMLREQUEST option but this appears to work only on
        > the same domain - or have I got this totally wrong?[/color]

        Due to the Same Origin Policy it only works on the same second-level
        domain.
        <http://www.mozilla.org/projects/security/components/same-origin.html>
        [color=blue]
        > jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply[/color]

        Remove `yourpants' to post standards compliant and to be not ignored
        in the future.


        PointedEars

        Comment

        • Randy Webb

          #5
          Re: Converting textbox contents to xml

          Thomas 'PointedEars' Lahn wrote:[color=blue]
          > Jeff North wrote:[/color]

          <snip>
          [color=blue][color=green]
          >>jnorthau@your pantsyahoo.com. au : Remove your pants to reply[/color]
          >
          >
          > Remove `yourpants' to post standards compliant and to be not ignored
          > in the future.[/color]

          Here we go again.......... . What "Standard" are you babbling about?

          Comment

          • Jeff North

            #6
            Re: Converting textbox contents to xml

            On Wed, 20 Apr 2005 00:08:44 +0200, in comp.lang.javas cript Thomas
            'PointedEars' Lahn <PointedEars@we b.de> wrote:
            [color=blue]
            >| Jeff North wrote:
            >|
            >| > I need to copy the contents of another website into a textarea
            >| > (actually a HTMLArea textarea that retains all of the html code) on to
            >| > my webpage. Then I need to extract certain parts of this page for my
            >| > database. From this copy/paste action I would like to walk through the
            >| > copied data. The trouble is that it is only data. I need to convert
            >| > this data to XHTML format. Is there a method (either server-side or
            >| > client-side) that will allow me to do this?
            >|
            >| Use XMLHttpRequest and then an XMLParser object to parse what is served.[/color]

            Yep, tried that but it the data is on another web site.
            I was trying to automate a process for my users.
            Guess I'll have to use the old copy/paste method :-(
            [color=blue]
            >| > Just to add to the problem. I've looked at the code and it is not
            >| > xhtml compliant code (they don't close off a lot of their tags i.e.
            >| > <P> missing closing </P> tag). Will this cause problems with the
            >| > conversion?
            >| >
            >| > I've looked at XMLHTMLREQUEST option but this appears to work only on
            >| > the same domain - or have I got this totally wrong?
            >|
            >| Due to the Same Origin Policy it only works on the same second-level
            >| domain.
            >| <http://www.mozilla.org/projects/security/components/same-origin.html>
            >|
            >| > jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
            >|
            >| Remove `yourpants' to post standards compliant and to be not ignored
            >| in the future.
            >|
            >|
            >| PointedEars[/color]

            ---------------------------------------------------------------
            jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
            ---------------------------------------------------------------

            Comment

            • Thomas 'PointedEars' Lahn

              #7
              Re: Converting textbox contents to xml

              Jeff North wrote:
              [color=blue]
              > On Wed, 20 Apr 2005 00:08:44 +0200, in comp.lang.javas cript Thomas
              > 'PointedEars' Lahn <PointedEars@we b.de> wrote:[/color]

              Your attribution contains superfluous, duplicate information for the
              most part.
              [color=blue][color=green]
              >>| Jeff North wrote:
              >>| > I need to copy the contents of another website into a textarea
              >>| > (actually a HTMLArea textarea that retains all of the html code)[/color][/color]

              Why?
              [color=blue][color=green]
              >>| > my webpage. Then I need to extract certain parts of this page for my
              >>| > database. From this copy/paste action I would like to walk through the
              >>| > copied data. The trouble is that it is only data. I need to convert
              >>| > this data to XHTML format. Is there a method (either server-side or
              >>| > client-side) that will allow me to do this?
              >>|
              >>| Use XMLHttpRequest and then an XMLParser object to parse what is served.[/color]
              >
              > Yep, tried that but it the data is on another web site.[/color]

              Do you mean another second-level domain? If no, please re-read my
              previous article more thoroughly. And please trim your quotes.


              PointedEars

              Comment

              • Jeff North

                #8
                Re: Converting textbox contents to xml

                On Thu, 21 Apr 2005 01:02:21 +0200, in comp.lang.javas cript Thomas
                'PointedEars' Lahn <PointedEars@we b.de> wrote:
                [color=blue]
                >| Your attribution contains superfluous, duplicate information for the
                >| most part.[/color]

                So.
                [color=blue]
                >| Why?[/color]

                It would be easier to walk through the DOM nodes than to try and get
                information out of plain text with \r\n control characters
                [color=blue]
                >| Do you mean another second-level domain?[/color]

                No. I mean it is on another web site i.e. my site
                http://www.mydomain.com and the other is on http://www.microsoft.com
                [color=blue]
                >| If no, please re-read my
                >| previous article more thoroughly. And please trim your quotes.[/color]

                It this post trimmed enough for you?
                ---------------------------------------------------------------
                jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
                ---------------------------------------------------------------

                Comment

                • Dr John Stockton

                  #9
                  Re: Converting textbox contents to xml

                  JRS: In article <1187529.DEEL4x g35G@PointedEar s.de>, dated Thu, 21 Apr
                  2005 01:02:21, seen in news:comp.lang. javascript, Thomas 'PointedEars'
                  Lahn <PointedEars@we b.de> posted :[color=blue]
                  >Jeff North wrote:
                  >[color=green]
                  >> On Wed, 20 Apr 2005 00:08:44 +0200, in comp.lang.javas cript Thomas
                  >> 'PointedEars' Lahn <PointedEars@we b.de> wrote:[/color]
                  >
                  >Your attribution contains superfluous, duplicate information for the
                  >most part.[/color]

                  From your limited and inexperienced point of view, perhaps.

                  However, the attribute quoted is compatible with the current thinking of
                  Usefor, the News expert team; and objecting to it is childish.

                  --
                  © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
                  <URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
                  <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
                  <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

                  Comment

                  • Thomas 'PointedEars' Lahn

                    #10
                    Re: Converting textbox contents to xml

                    Jeff North wrote:
                    [color=blue]
                    > [...] Thomas 'PointedEars' Lahn [...] wrote:[color=green]
                    >>| Your attribution contains superfluous, duplicate information for the
                    >>| most part.[/color]
                    >
                    > So.[/color]

                    If that is a statement: Yes.
                    If that is a question, it begs the answer: Don't do it then.
                    [color=blue][color=green]
                    >>| Why?[/color]
                    >
                    > It would be easier to walk through the DOM nodes than to try and get
                    > information out of plain text with \r\n control characters[/color]

                    The question was: Why you

                    | [...] need to copy the contents of another website into a textarea
                    | (actually a HTMLArea textarea that retains all of the html code)

                    ? That is somehow a contradiction to your actual goal.
                    [color=blue][color=green]
                    >>| Do you mean another second-level domain?[/color]
                    >
                    > No. I mean it is on another web site i.e. my site
                    > http://www.mydomain.com and the other is on http://www.microsoft.com[/color]

                    I very much doubt this is possible with client-side scripting since
                    the SOP, as mentioned, forbids that. Server-side scripting is a viable
                    approach here, provided that laws are obeyed.
                    [color=blue][color=green]
                    >>| If no, please re-read my
                    >>| previous article more thoroughly. And please trim your quotes.[/color]
                    >
                    > It this post trimmed enough for you?[/color]

                    Too much for some parts, context gets lost sometimes (e.g. the "Why?"
                    quote). Quotation should be a friendly reminder for the reader only.
                    Not snipped too much, not too less of it. And quotes of quotes should
                    be summarized where possible to save the reader time and bandwidth usage.

                    Your quotation level style, however, is unusual (and as such as
                    disturbing as --
                    [color=blue]
                    > ---------------------------------------------------------------
                    > jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
                    > ---------------------------------------------------------------[/color]

                    -- while the above additionally does not really make sense, taking
                    into account the content of your From/Reply-To headers.)

                    You may want to read the newsgroup's FAQ about that:

                    <http://jibbering.com/faq/#FAQ2_3>
                    <http://www.jibbering.c om/faq/faq_notes/pots1.html>


                    PointedEars

                    Comment

                    • Jeff North

                      #11
                      Re: Converting textbox contents to xml

                      On Sat, 23 Apr 2005 17:07:03 +0200, in comp.lang.javas cript Thomas
                      'PointedEars' Lahn <PointedEars@we b.de> wrote:
                      [color=blue]
                      >| Jeff North wrote:
                      >|
                      >| > [...] Thomas 'PointedEars' Lahn [...] wrote:
                      >| >>| Your attribution contains superfluous, duplicate information for the
                      >| >>| most part.
                      >| >
                      >| > So.
                      >|
                      >| If that is a statement: Yes.
                      >| If that is a question, it begs the answer: Don't do it then.[/color]

                      I'll set my newsreader the way *I* want it, thank you very much.

                      [snip]
                      [color=blue]
                      >| > It this post trimmed enough for you?
                      >|
                      >| Too much for some parts, context gets lost sometimes (e.g. the "Why?"
                      >| quote). Quotation should be a friendly reminder for the reader only.
                      >| Not snipped too much, not too less of it. And quotes of quotes should
                      >| be summarized where possible to save the reader time and bandwidth usage.[/color]

                      Please make up your mind. The above method you stated is my usual
                      style yet you complained.
                      [color=blue]
                      >| Your quotation level style, however, is unusual (and as such as
                      >| disturbing as --
                      >|
                      >| > ---------------------------------------------------------------
                      >| > jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
                      >| > ---------------------------------------------------------------
                      >|
                      >| -- while the above additionally does not really make sense, taking
                      >| into account the content of your From/Reply-To headers.)[/color]

                      I don't have to explain my addresses to you or anyone else as it is
                      quite obvious what I'm doing. The fact that you find it 'disturbing'
                      is your problem.
                      [color=blue]
                      >| You may want to read the newsgroup's FAQ about that:
                      >|
                      >| <http://jibbering.com/faq/#FAQ2_3>
                      >| <http://www.jibbering.c om/faq/faq_notes/pots1.html>[/color]

                      Which states absolutely nothing about address/Reply To headers.
                      [color=blue]
                      >| PointedEars[/color]

                      Oh BTW

                      PLONK
                      ---------------------------------------------------------------
                      jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
                      ---------------------------------------------------------------

                      Comment

                      Working...