Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Fetch & Read XML Data into HTML File? >Thread Next - Re: Fetch & Read XML Data into HTML File? Re: Fetch & Read XML Data into HTML File?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/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
