displaying xml in a field - solved

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jeffInt
Posts: 23
Joined: Tue Jun 17, 2008 8:29 pm

displaying xml in a field - solved

Post by jeffInt » Sun Jun 21, 2009 8:59 pm

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
Last edited by jeffInt on Mon Jun 22, 2009 1:59 pm, edited 1 time in total.
Chat with other RunRev developers, pop over to www.bjoernke.com/runrev/chatrev.php

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Post by malte » Sun Jun 21, 2009 9:54 pm

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

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Contact:

Post by malte » Sun Jun 21, 2009 9:57 pm

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

jeffInt
Posts: 23
Joined: Tue Jun 17, 2008 8:29 pm

Post by jeffInt » Sun Jun 21, 2009 10:06 pm

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
Chat with other RunRev developers, pop over to www.bjoernke.com/runrev/chatrev.php

jeffInt
Posts: 23
Joined: Tue Jun 17, 2008 8:29 pm

Post by jeffInt » Mon Jun 22, 2009 1:58 pm

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.
Chat with other RunRev developers, pop over to www.bjoernke.com/runrev/chatrev.php

Post Reply