2 Replies Latest reply on Jan 17, 2018 4:55 PM by tlichtenberger-2 RSS
    tlichtenberger-2 Apprentice

    JavaScript: Cannot get @var-value from xml-file because var is reserved?

    hey everyone!


    I am trying to get some weather data from the openweathermap-webservice. Among the data is a the iconCode too in order to visualize the current weather condition.

    Here is the xml-response of the given request:



    request-URL: http://api.openweathermap.org/data/2.5/forecast?q=linz&units=metric&type=accurate&mode=xml&APPID=ef67184baece136977466e7894b2a614


    one part of the response: ( i have shortened it a bit)






    I want to retrieve all iconCodes of all forecast-days. (And it works fine with the temperature, wind direction, etc...


    a part of the function which should get the data from the webservice:




    If I add the line var iconCode = item.symbol.@var, I get the following syntax error:



    I think I get the error because "var" is a reserved string in JavaScript. But how do I get the iconCode from the xmlPage then? Any suggestions?



    Thank you so much in advance for helping me out!

    Best regards,