Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Fetch & Read XML Data into HTML File?

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 9/9/2008 12:40:00 PM

Richard In Va. wrote:

> So your suggesting I do this...
> 
> <html>
> <title></title>
> <head></head>
> <body>
> 
> <script language="JavaScript">

I would put (all) the code to load and parse the XML into a function and 
call that function in the onload handler e.g.
   function loadXml (url)
   {
      var doc = ...;
      ...
   }
   window.onload = function () {
      loadXml('http://xoap.weather.com/weather/local/23218?cc=&dayf=7');
   };

>    var doc = new ActiveXObject('Msxml2.DOMDocument.3.0');
>    doc.async = false;
>    if (doc.load('http://xoap.weather.com/weather/local/23218?cc=&dayf=7'))
> 
>    {
>      doc.setProperty('SelectionLanguage', 'XPath');
>      var locEl = doc.selectSingleNode('/wheather/loc');
                                          ^^^^^^^^^
The word and element name is spelled 'weather' not 'wheater'. Sorry that 
I misspelled that in my earlier post.



> As you can see, I'm probably completely lost, but I wonder if DOM scripting 
> would make things more simple for me.

I think the problem is just the misspelled element name, other than that 
you are doing fine. Only if you have data for seven days of the week 
then you need to make sure you have seven rows in your table and 
different ids for those elements.

> And with HTA, I loose the browser toolbar and tabed browsing that I would 
> have with a HTML file.

If you want to use the browser IE and not a HTA then you need to check 
whether you can put the site you want to use into the trusted sites zone 
of IE and enable the access across domains for that zone.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent