Page 1 of 1

displaying xml in a field - solved

Posted: Sun Jun 21, 2009 8:59 pm
by jeffInt
I have an extremely simple script which should display the contents of a web page. The web page is returned from the google weather api and as far as I can see is a lot larger in content than shown by my script.

Here is the script

on mouseUp
local tURL, tTree

put "http://google.co.uk/ig/api?weather=dl56up" into tURL
put revCreateXMLTree(tURL,false,true,false) into tTree
put revXMLText(tTree, ,false) into field "ListXML"

revDeleteXMLTree tTree
end mouseUp


first I create a URL and then a tree using the URL as an argument. My attempts to display the contents result in only the first line of the XML being shown;

<?xml version="1.0"?>

I have entered the URL into a web browser to make sure things are ok, which they are.

Anyone have an idea why I do not see more of the XML stream in my field?

Regards

Jeff

Posted: Sun Jun 21, 2009 9:54 pm
by malte
Hi, the problem is that you parse the string that contains the URL, not the contents of the URL. This should work:

on mouseUp
local tURL, tTree,tXML
put "http://google.co.uk/ig/api?weather=dl56up" into tURL
put URL tURL into tXML
put revCreateXMLTree(tXML,true,true,false) into tTree
put revXMLText(tTree, ,false) into field "ListXML"
revDeleteXMLTree tTree
end mouseUp

cheers,

Malte

Posted: Sun Jun 21, 2009 9:57 pm
by malte
I forgot to mention, that the output you see is due to the first parameter (dontparsebaddata) This used to be wrong described in the dict as parsebaddata. Maybe that's where the confusion comes from :)

Malte

Posted: Sun Jun 21, 2009 10:06 pm
by jeffInt
Fantastic - partly. When I debug I can now see in variable tXML a long string of text from the web page. Unfortunately the script still only shows the first lin of this string. I have checked that the field allows wrapping.

I am impressed with your knowledge, this doesn't look like something I've seen in the documentation.

Jeff

Posted: Mon Jun 22, 2009 1:58 pm
by jeffInt
OK I re read your post from yesterday and I found the mistake I made in trancribing to my code. It's amazing what a nights sleep will get you!

I can now see the XML in my display field - cheers.