1 Reply Latest reply on Jul 20, 2006 11:42 AM by Newsgroup_User

    load HTML to XML object -> problem

    Level 7
      hi, I want to parse some data from some sites into flash. the idea is:

      var xmlHTML:XML =3D new XML();
      xmlHTML.load(" http://www.google.com");
      xmlHTML.ignoreWhite =3D true;
      xmlHTML.onLoad =3D function():Void {
      trace(this);
      }

      the problem is that my xmlHTML object doesn't load the exact source code =

      of google page :(( I don't understand why :( as you can see down in=20
      "attachment", flash completly ignores <body> tag. I can't figure why. If =

      somebody knows how to fix it, please help!
      THANKS!
















      /////////////////// ATTACHMENT: ////////////////////

      ******************************** TRACED OUTPUT:
      <html><head><meta http-equiv=3D"content-type" content=3D"text/html;=20
      charset=3DISO-8859-2"><title>Google</title><style /><script=20
      /></meta></head></html>




      ******************************** REAL SOURCE CODE:
      <html><head><meta http-equiv=3D"content-type" content=3D"text/html;=20
      charset=3DUTF-8"><title>Google</title><style><!--
      body,td,a,p,.h{font-family:arial,sans-serif;}
      =2Eh{font-size: 20px;}
      =2Eq{color:#0000cc;}
      -->
      </style>
      <script>
      <!--
      function sf(){document.f.q.focus();}
      function rwt(el,oi,cad,ct,cd,sg){var e =3D window.encodeURIComponent ?=20
      encodeURIComponent : escape;var oi_param=3D"";var cad_param=3D"";if (oi) =

      oi_param=3D"&oi=3D"+e(oi);if (cad)=20
      cad_param=3D"&cad=3D"+e(cad);el.href=3D"/url?sa=3Dt"+oi_param+cad_param+"=
      &ct=3D"+e(ct)+"&cd=3D"+e(cd)+"&url=3D"+e(el.href).replace(/\+/g,"%2B")+"&=
      ei=3DBba_RPrNL8vMSP746IMK"+sg;el.onmousedown=3D"";return=20
      true;}
      // -->
      </script>
      </head><body bgcolor=3D#ffffff text=3D#000000 link=3D#0000cc vlink=3D#551=
      a8b=20
      alink=3D#ff0000 onLoad=3Dsf() topmargin=3D3 marginheight=3D3><center><tab=
      le=20
      cellpadding=3D0 cellspacing=3D0 border=3D0><tr><td align=3Dright=20
      valign=3Dbottom><img src=3Dimages/hp0.gif width=3D158 height=3D78=20
      alt=3D"Google"></td><td valign=3Dbottom><img src=3Dimages/hp1.gif width=3D=
      50=20
      height=3D78 alt=3D""></td><td valign=3Dbottom><img src=3Dimages/hp2.gif w=
      idth=3D68=20
      height=3D78 alt=3D""></td></tr><tr><td class=3Dh align=3Dright=20
      valign=3Dtop><b></b></td><td valign=3Dtop><img src=3Dimages/hp3.gif width=
      =3D50=20
      height=3D32 alt=3D""></td><td valign=3Dtop class=3Dh><font color=3D#6f6f6=
      f=20
      style=3Dfont-size:16px><b>Slovenskej=20
      republiky</b></font></td></tr></table><br>
      <form action=3D/search name=3Df><script><!--
      function qs(el) {if (window.RegExp && window.encodeURIComponent) {var=20
      ue=3Del.href;var=20
      qe=3DencodeURIComponent(document.f.q.value);if(ue.indexOf("q=3D")!=3D-1){=
      el.href=3Due.replace(new=20
      RegExp("q=3D[^&$]*"),"q=3D"+qe);}else{el.href=3Due+"&q=3D"+qe;}}return 1;=
      }
      // -->
      </script><table border=3D0 cellspacing=3D0 cellpadding=3D4><tr><td=20
      nowrap><font size=3D-1><b>Web</b>    <a id=3D1a class=
      =3Dq=20
      href=3D"/imghp?hl=3Dsk&tab=3Dwi" onClick=3D"return=20
      qs(this);">Obr=C3=A1zky</a>    <a id=3D2a class=3Dq=20
      href=3D" http://groups.google.sk/grphp?hl=3Dsk&tab=3Dwg" onClick=3D"return=
      =20
      qs(this);">Skupiny</a>    <a id=3D3a class=3Dq=20
      href=3D"/dirhp?hl=3Dsk&tab=3Dwd" onClick=3D"return=20
      qs(this);">Katal=C3=B3g</a>    </font></td></tr></tab=
      le><table=20
      cellspacing=3D0 cellpadding=3D0><tr><td width=3D25%> </td><td=20
      align=3Dcenter><input type=3Dhidden name=3Dhl value=3Dsk><input maxlength=
      =3D2048=20
      size=3D55 name=3Dq value=3D"" title=3D"H=C4=BEada=C5=A5 v Google"><br><in=
      put type=3Dsubmit=20
      value=3D"H=C4=BEada=C5=A5 v Google" name=3DbtnG><input type=3Dsubmit valu=
      e=3D"Dnes m=C3=A1m=20
      =C5=A1=C5=A5astn=C3=BD de=C5=88" name=3DbtnI></td><td valign=3Dtop nowrap=
      width=3D25%><font=20
      size=3D-2>  <a href=3D/advanced_search?hl=3Dsk>Roz=C5=A1=C3=ADr=
      en=C3=A9=20
      h=C4=BEadanie</a><br>  <a=20
      href=3D/preferences?hl=3Dsk>Nastavenia</a><br>  <a=20
      href=3D/language_tools?hl=3Dsk>Jazykov=C3=A9 n=C3=A1stroje</a></font></td=
      ></tr><tr><td=20
      colspan=3D3 align=3Dcenter><font size=3D-1>H=C4=BEadaj: <input id=3Dall t=
      ype=3Dradio=20
      name=3Dmeta value=3D"" checked><label for=3Dall> web </label><input id=3D=
      lgr=20
      type=3Dradio name=3Dmeta value=3D"lr=3Dlang_sk" ><label for=3Dlgr> str=C3=
      =A1nky p=C3=ADsan=C3=A9=20
      po slovensky </label><input id=3Dcty type=3Dradio name=3Dmeta=20
      value=3D"cr=3DcountrySK" ><label for=3Dcty> str=C3=A1nky z krajiny Sloven=
      sko=20
      </label></font></td></tr></table></form><br><br><font size=3D-1><a=20
      href=3D/intl/sk/ads/>Reklamn=C3=A9 programy</a> - <a=20
      href=3D/intl/sk/about.html>V=C5=A1etko o Google</a> - <a=20
      href=3D http://www.google.com/ncr>Google.com in English</a></font><p><font=
      =20
      size=3D-2>&copy;2006 Google</font></p></center></body></html>
        • 1. Re: load HTML to XML object -&gt; problem
          Level 7
          The google body tag is not valid xml. You'll need to use XML.onData and
          parse the data yourself.

          "Pepa" <pepiik@gmail.com> wrote in message
          news:e9ocrh$lrc$1@forums.macromedia.com...
          hi, I want to parse some data from some sites into flash. the idea is:

          var xmlHTML:XML = new XML();
          xmlHTML.load(" http://www.google.com");
          xmlHTML.ignoreWhite = true;
          xmlHTML.onLoad = function():Void {
          trace(this);
          }

          the problem is that my xmlHTML object doesn't load the exact source code
          of google page :(( I don't understand why :( as you can see down in
          "attachment", flash completly ignores <body> tag. I can't figure why. If
          somebody knows how to fix it, please help!
          THANKS!
















          /////////////////// ATTACHMENT: ////////////////////

          ******************************** TRACED OUTPUT:
          <html><head><meta http-equiv="content-type" content="text/html;
          charset=ISO-8859-2"><title>Google</title><style /><script
          /></meta></head></html>




          ******************************** REAL SOURCE CODE:
          <html><head><meta http-equiv="content-type" content="text/html;
          charset=UTF-8"><title>Google</title><style><!--
          body,td,a,p,.h{font-family:arial,sans-serif;}
          .h{font-size: 20px;}
          .q{color:#0000cc;}
          -->
          </style>
          <script>
          <!--
          function sf(){document.f.q.focus();}
          function rwt(el,oi,cad,ct,cd,sg){var e = window.encodeURIComponent ?
          encodeURIComponent : escape;var oi_param="";var cad_param="";if (oi)
          oi_param="&oi="+e(oi);if (cad)
          cad_param="&cad="+e(cad);el.href="/url?sa=t"+oi_param+cad_param+"&ct="+e(ct)
          +"&cd="+e(cd)+"&url="+e(el.href).replace(/\+/g,"%2B")+"&ei=Bba_RPrNL8vMSP746
          IMK"+sg;el.onmousedown="";return
          true;}
          // -->
          </script>
          </head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b
          alink=#ff0000 onLoad=sf() topmargin=3 marginheight=3><center><table
          cellpadding=0 cellspacing=0 border=0><tr><td align=right
          valign=bottom><img src=images/hp0.gif width=158 height=78
          alt="Google"></td><td valign=bottom><img src=images/hp1.gif width=50
          height=78 alt=""></td><td valign=bottom><img src=images/hp2.gif width=68
          height=78 alt=""></td></tr><tr><td class=h align=right
          valign=top><b></b></td><td valign=top><img src=images/hp3.gif width=50
          height=32 alt=""></td><td valign=top class=h><font color=#6f6f6f
          style=font-size:16px><b>Slovenskej
          republiky</b></font></td></tr></table><br>
          <form action=/search name=f><script><!--
          function qs(el) {if (window.RegExp && window.encodeURIComponent) {var
          ue=el.href;var
          qe=encodeURIComponent(document.f.q.value);if(ue.indexOf("q=")!=-1){el.href=u
          e.replace(new
          RegExp("q=[^&$]*"),"q="+qe);}else{el.href=ue+"&q="+qe;}}return 1;}
          // -->
          </script><table border=0 cellspacing=0 cellpadding=4><tr><td
          nowrap><font size=-1><b>Web</b>    <a id=1a class=q
          href="/imghp?hl=sk&tab=wi" onClick="return
          qs(this);">Obr�zky</a>    <a id=2a class=q
          href=" http://groups.google.sk/grphp?hl=sk&tab=wg" onClick="return
          qs(this);">Skupiny</a>    <a id=3a class=q
          href="/dirhp?hl=sk&tab=wd" onClick="return
          qs(this);">Katal�g</a>    </font></td></tr></table><tabl
          e
          cellspacing=0 cellpadding=0><tr><td width=25%> </td><td
          align=center><input type=hidden name=hl value=sk><input maxlength=2048
          size=55 name=q value="" title="Hladat v Google"><br><input type=submit
          value="Hladat v Google" name=btnG><input type=submit value="Dnes m�m
          stastn� den" name=btnI></td><td valign=top nowrap width=25%><font
          size=-2>  <a href=/advanced_search?hl=sk>Rozs�ren�
          hladanie</a><br>  <a
          href=/preferences?hl=sk>Nastavenia</a><br>  <a
          href=/language_tools?hl=sk>Jazykov� n�stroje</a></font></td></tr><tr><td
          colspan=3 align=center><font size=-1>Hladaj: <input id=all type=radio
          name=meta value="" checked><label for=all> web </label><input id=lgr
          type=radio name=meta value="lr=lang_sk" ><label for=lgr> str�nky p�san�
          po slovensky </label><input id=cty type=radio name=meta
          value="cr=countrySK" ><label for=cty> str�nky z krajiny Slovensko
          </label></font></td></tr></table></form><br><br><font size=-1><a
          href=/intl/sk/ads/>Reklamn� programy</a> - <a
          href=/intl/sk/about.html>Vsetko o Google</a> - <a
          href=http://www.google.com/ncr>Google.com in English</a></font><p><font
          size=-2>&copy;2006 Google</font></p></center></body></html>