Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Problem with Prontoscript and XML
This thread has 8 replies. Displaying all posts.
Post 1 made on Saturday May 5, 2012 at 18:04
Fistandantilus
Lurking Member
Joined:
Posts:
May 2012
4
Hi,

Since some years I´m using Pronto remotes. Now I´ve got a TSU7400 and starting to configure it.
As there seems to be no working weather script I started to adapt ScottGrimes version to my Pronto.
As I do not want to pay for weather.com I was looking for an alternative which google.com offers.
I already get XML back to my Pronto but reading the different segments is not working. Maybe someone could have a look into that.

Here the XML:

<xml_api_reply version="1">
<weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0">
<forecast_information>
    <city data="Dresden, Saxony"/>
    <postal_code data="dresden"/>
    <latitude_e6 data=""/>
    <longitude_e6 data=""/>
    <forecast_date data="2012-05-05"/>
    <current_date_time data="1970-01-01 00:00:00 +0000"/>
    <unit_system data="SI"/>
</forecast_information>
<current_conditions>
    <condition data="Leichter Regen"/>
    <temp_f data="54"/>
    <temp_c data="12"/>
    <humidity data="Feuchtigkeit: 94 %"/>
    <icon data="/ig/images/weather/mist.gif"/>
    <wind_condition data="Wind: NO mit Windgeschwindigkeiten von 14 km/h"/>
</current_conditions>
<forecast_conditions>
    <day_of_week data="Sa."/>
    <low data="6"/>
    <high data="21"/>
    <icon data="/ig/images/weather/chance_of_storm.gif"/>
    <condition data="Vereinzelt stürmisch"/>
</forecast_conditions>
<forecast_conditions>...</forecast_conditions>
<forecast_conditions>...</forecast_conditions>
<forecast_conditions>...</forecast_conditions>
</weather>
</xml_api_reply>


This is the current code:

    // Trim the XML tag off if it was included.
    if (xmlData.indexOf("<?xml"))  
        xmlData = xmlData.substring(xmlData.indexOf("?>")+2);

    // DEFINE VARIABLES

    var weatherData = new XML(xmlData);
    //CF.widget("_PS_DEBUG_").label = weatherData; -> here I can see above posted XML data

    // Obtain the name of city based on city code data
    var locationText = "" + weatherData.forecast_information.city;  // Force it to be a string
    CF.widget("_PS_DEBUG_").label = weatherData.forecast_information.city;


-> getting no values displayed
also tried
CF.widget("_PS_DEBUG_").label = weatherData.weather.forecast_information.city;
CF.widget("_PS_DEBUG_").label = weatherData.weather[0].forecast_information.city;


Best regards,
F.
iPronto -> RU990 -> TSU7400
OP | Post 2 made on Saturday May 5, 2012 at 18:27
Fistandantilus
Lurking Member
Joined:
Posts:
May 2012
4
Just a quick update. Seems a was to quick Scotts version is working on my 7400 now. Just sumulator was not working thats why I swiched to google.
But anyway I would like to find a solution for my described problem.

One further question. Is internet connection in general not working for simulator?
Maybe it is a problem of my virtual machine?
iPronto -> RU990 -> TSU7400
Post 3 made on Saturday May 5, 2012 at 23:08
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,633
TCP connection does not work for simulator. Search for TCP and Welfringer
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 4 made on Sunday May 6, 2012 at 02:36
Fistandantilus
Lurking Member
Joined:
Posts:
May 2012
4
Sounds good. Just dropped him a message as it does not seem to be available in download area.
Any idea on the original issue?
iPronto -> RU990 -> TSU7400
Post 5 made on Sunday May 6, 2012 at 13:31
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,633
Try this as the data is not text child of node, but rather an attribute. Also have a look at the examples in the ECMA357 PDF which you can find from google (E4X).

CF.widget("_PS_DEBUG_").label = [email protected];


I think that _PS_DEBUG_ widget is reserved name and if widget is present on the page, any output you send using system.print() calls will overwrite the label.

Might I suggest using something like (note use of GUI.widget and CF.widget - there is a thread I authored here that discusses the differences. I suggest you use GUI.widget whenever possible except when you must fetch resources from other pages.)

GUI.widget("MY_TEST_VALUE").label = [email protected];


Regards,
Lyndel
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 6 made on Monday May 7, 2012 at 16:20
Fistandantilus
Lurking Member
Joined:
Posts:
May 2012
4
Thx Lyndel, I will test it this week. Unfortunatelly currently too much work.
I know about _PS_DEBUG_. I was just using it for debugging what data variables are containing.

I have completelly migrated Scotts version meanwhile to the TSU9400. Due to smaler screen I only have 3 day forecast but any other data is displayed :)
Lets see how often it will get used - I think it is more or less just a nice feature to show what you can do with the remote.

Other than RU990 this remote does not have rf anymore so I need to get ir to rf transmitter to be able to controll light again.
iPronto -> RU990 -> TSU7400
Post 7 made on Thursday July 2, 2020 at 14:59
thebaz67
Long Time Member
Joined:
Posts:
December 2008
13
I know this is an old thread but I found it useful but I needed to add a period prior to the @ symbol to display the attribute.
Post 8 made on Monday July 6, 2020 at 20:03
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,633
Can you post a sample of the XML where you found you had to use the . before @?

Thanks,
Lyndel
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 9 made on Tuesday July 14, 2020 at 16:35
thebaz67
Long Time Member
Joined:
Posts:
December 2008
13
function ParseXML(xmldata)
{
var xmldata = xmldata.replace(/^<\?xml\s+version\s*=\s*(['"])[^\1]+\1[^?]*\?>/, "")
var weatherData = new XML(xmldata);

// Set Activity label to 'standby'.
CF.activity().label = "standby mode...";


// Obtain the name of city based on city code data.
var locationText = "" + [email protected]; // Force it to be a string.




if I left out the . prior to the @ I did not get the information from the xml file I was expecting.

When I used the _PS_DEBUG I would see an error if I left out the period.

This is not my code, It is from Scott's weather module, I am just making the changes to use the openweather feed.

thank you for your help, it seems to be working now.


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse