Witam, szukam metody na pobranie danych z pliku XML za pomocą jquery i z takiego kodu już umiem pobrać:
<?xml version="1.0"?>
<xml_api_reply version="1">
<weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0">
<forecast_conditions>
<day_of_week>czw.</day_of_week>
<icon>/ig/images/weather/chance_of_snow.gif</icon>
</forecast_conditions>
</weather>
</xml_api_reply>
użyłem takiego kodu znalezionego w sieci:
$(document).ready(function () {
$.ajax({
type: "GET",
url: "api2.xml",
dataType: "xml",
success: fParsujXml
});
});
function fParsujXml(xml) {
$(xml).find("forecast_conditions").each(function () {
$(".wpisy").append('
<div class="wpisy"><div class="tytul">'
+ $(this).find("day_of_week").text() + '
</div>'
+ $(this).find("icon").text() + '
</div></div>');
$(".wpisy").fadeIn(1000);
});
}
Niestety nie wiem jak pobrać dane jeśli mam taki układ (plik z pogodą google)
W tym dokumencie nie określono arkusza stylów.
<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="Wroclaw, Lower Silesian Voivodeship"/>
<postal_code data="wroclaw"/>
<latitude_e6 data=""/>
<longitude_e6 data=""/>
<forecast_date data="2012-02-16"/>
<current_date_time data="1970-01-01 00:00:00 +0000"/>
<unit_system data="SI"/>
</forecast_information>
<current_conditions>
<condition data="Częściowe zachm."/>
<temp_f data="28"/>
<temp_c data="-2"/>
<humidity data="Wilgotność: 80%"/>
<icon data="/ig/images/weather/partly_cloudy.gif"/>
<wind_condition data="Wiatr: zach. z szybkością 10 km/h"/>
</current_conditions>
<forecast_conditions>
<day_of_week data="czw."/>
<low data="-4"/>
<high data="1"/>
<icon data="/ig/images/weather/chance_of_snow.gif"/>
<condition data="Możliwe opady śniegu"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="pt."/>
<low data="-2"/>
<high data="4"/>
<icon data="/ig/images/weather/snow.gif"/>
<condition data="Śnieg"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="sob."/>
<low data="1"/>
<high data="4"/>
<icon data="/ig/images/weather/fog.gif"/>
<condition data="Mgła"/>
</forecast_conditions>
<forecast_conditions>
<day_of_week data="niedz."/>
<low data="-5"/>
<high data="4"/>
<icon data="/ig/images/weather/chance_of_rain.gif"/>
<condition data="Możliwe opady deszczu"/>
</forecast_conditions>
</weather>
</xml_api_reply>
Może mi ktoś podać przykład jak należy to zrobić?
Nie jestem programistą i czytanie dokumentacji na niewiele mi się zdaje (IMG:
style_emoticons/default/sad.gif) bo i tak nie wiem jak to ugryźć.