Lively Kernel canvas
// this script is evaluated on world load
).*(<.*?>)/.exec(Exporter.stringify(xml));
list.unshift(objCreator(indent + ownXMLStrings[1], xml));
list.push(objCreator(indent + ownXMLStrings[2], xml));
return list;
},
xmlToString: function(xml, indent) {
if (!indent) indent = '';
if (!xml || xml instanceof DocumentType) return '';
if (!xml.parentNode) return XMLConverter.xmlToString(xml.firstChild, indent); // omit root
if (!xml.hasChildNodes()) return indent + Exporter.stringify(xml);
var list = $A(xml.childNodes).inject([], function(all, ea) {
return all.concat(XMLConverter.xmlToString(ea, indent + '\t')) });
// get just the tag opener and closer for the string
var ownXMLStrings = /(<.*?>).*(<.*?>)/.exec(Exporter.stringify(xml));
list.unshift(indent + ownXMLStrings[1]);
list.push(indent + ownXMLStrings[2]);
return list.join('\n');
},
};]]>
ProgrammierenmitderWebbasiertenEntwicklungsumgebungLivelyKernel18
GruppeXX40
10000.7216535342542Wikicontroltrue
2
Step1:Playwithworkspace,variables,morphs,stuffStep2:GetandexamineXMLfromGoogleStep3:AccessXMLprogrammatically2
10000.000009875663472559413Wikicontroltrue
//XMLConverter.xmlToString(doc)<xml_api_replyversion="1"><weathermodule_id="0"tab_id="0"mobile_row="0"mobile_zipped="1"row="0"section="0"><forecast_information><citydata="Potsdam,BB"/><postal_codedata="Potsdam"/><latitude_e6data=""/><longitude_e6data=""/><forecast_datedata="2010-03-24"/><current_date_timedata="2010-03-2400:20:00+0000"/><unit_systemdata="US"/></forecast_information><current_conditions><conditiondata="Clear"/><temp_fdata="37"/><temp_cdata="3"/><humiditydata="Humidity:87%"/><icondata="/ig/images/weather/sunny.gif"/><wind_conditiondata="Wind:Nat1mph"/></current_conditions><forecast_conditions><day_of_weekdata="Wed"/><lowdata="41"/><highdata="62"/><icondata="/ig/images/weather/cloudy.gif"/><conditiondata="Cloudy"/></forecast_conditions><forecast_conditions><day_of_weekdata="Thu"/><lowdata="48"/><highdata="62"/><icondata="/ig/images/weather/sunny.gif"/><conditiondata="Clear"/></forecast_conditions><forecast_conditions><day_of_weekdata="Fri"/><lowdata="44"/><highdata="69"/><icondata="/ig/images/weather/mostly_sunny.gif"/><conditiondata="PartlySunny"/></forecast_conditions><forecast_conditions><day_of_weekdata="Sat"/><lowdata="42"/><highdata="53"/><icondata="/ig/images/weather/chance_of_rain.gif"/><conditiondata="ChanceofRain"/></forecast_conditions></weather></xml_api_reply>16\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\n\n"]]>truetruefalse49truetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
London,England1
2010-03-26
2010-03-2617:50:00+0000
Infos16
MostlyCloudy
Humidity:71%
Wind:SWat12mph
Wetter16
11ºC
nulltruevarzahl=Math.round(Math.random()*10)$morph('text').updateTextString(zahl.toString())url='http://www.google.com/ig/api?weather=Potsdam'r=newWebResource(url)doc=r.getXML()Exporter.stringify(doc)doc.getElementsByName()XMLConverter.xmlToString(doc)result=XMLConverter.xmlToJson(doc)doc.weatherProperties.all(result)Properties.all(result.xml_api_reply.weather.forecast_information.city)result.xml_api_reply.weather.forecast_information.city.dataFunctions.all(JSON)JSON.serialize(result)infos=result.xml_api_reply.weather.forecast_informationwetterJetzt=result.xml_api_reply.weather.current_conditions$morph('ort').updateTextString(infos.city.data);$morph('datum').updateTextString(infos.forecast_date.data)$morph('zeit').updateTextString(infos.current_date_time.data)$morph('beobachtung').updateTextString(wetterJetzt.condition.data);$morph('temperatur').updateTextString(wetterJetzt.temp_c.data+'ºC');$morph('feuchtigkeit').updateTextString(wetterJetzt.humidity.data);$morph('wind').updateTextString(wetterJetzt.wind_condition.data);this.loadFromURL('http://www.google.com/ig/images/weather/sunny.gif')truetruefalsetruetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
Imagemorphcreation222
10000.17817278280765864Wikicontroltrue
10000.0012057885464745958Wikicontroltrue
nulltrueholeWetterDaten=function(ort){varurl='http://www.google.com/ig/api?weather='+ort;vardoc=newWebResource(url).getXML();returnXMLConverter.xmlToJson(doc);}zeigeInfos=function(infos){$morph('ort').updateTextString(infos.city.data);$morph('datum').updateTextString(infos.forecast_date.data)$morph('zeit').updateTextString(infos.current_date_time.data)}zeigeWetter=function(wetter){$morph('beobachtung').updateTextString(wetter.condition.data);$morph('temperatur').updateTextString(wetter.temp_c.data+'ºC');$morph('feuchtigkeit').updateTextString(wetter.humidity.data);$morph('wind').updateTextString(wetter.wind_condition.data);$morph('wetterBild').loadFromURL('http://www.google.com'+wetter.icon.data)}holeUndZeigeWetter=function(ort){vargoogleWetter=holeWetterDaten(ort);varinfos=googleWetter.xml_api_reply.weather.forecast_information;varwetter=googleWetter.xml_api_reply.weather.current_conditions;zeigeInfos(infos);zeigeWetter(wetter);}holeUndZeigeWetter('London')29truetruefalsetruetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
nulltrue{"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":"Potsdam,BB"},"postal_code":{"data":"Potsdam"},"latitude_e6":{"data":""},"longitude_e6":{"data":""},"forecast_date":{"data":"2010-03-24"},"current_date_time":{"data":"2010-03-2400:20:00+0000"},"unit_system":{"data":"US"}},"current_conditions":{"condition":{"data":"Clear"},"temp_f":{"data":"37"},"temp_c":{"data":"3"},"humidity":{"data":"Humidity:87%"},"icon":{"data":"/ig/images/weather/sunny.gif"},"wind_condition":{"data":"Wind:Nat1mph"}},"forecast_conditions":{"day_of_week":{"data":"Sat"},"low":{"data":"42"},"high":{"data":"53"},"icon":{"data":"/ig/images/weather/chance_of_rain.gif"},"condition":{"data":"ChanceofRain"}}}}}165truetruefalsetruetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
falsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
nullfalsetruenullfalse
xmlToJSONfalsenullfalse
false
false
falsenullfalse
localrequirementsfalsetruefalse0false
initializerfalsetruefalse0false
WebResourceextensionfalsetruefalse0false
xmlToJSONfalsetruefalse0false3103nullnulltruetruetrue
1true
null
null
null
nulltruetrue
-----falsetruefalse0false310-1nullnulltruetruetrue
1true
null
null
null
nulltruetrue
XMLConverter={basicToJs:function(xml){varobj={},attrMap={};obj[xml.nodeName]=attrMap;if(!xml.attributes)returnobj;for(vari=0;i<xml.attributes.length;i++){varname=xml.attributes[i].name;varvalue=xml.attributes[i].value;attrMap[name]=value;}//FIXMEassumesdataisonlyimportantattribute...//obj[xml.nodeName]=xml.hasChildNodes()?{}:(xml.attributes&&xml.getAttribute('data'))||xml.textContent;returnobj;},xmlToJs:function(xml){varbaseObj=XMLConverter.basicToJs(xml);varchildObjs=$A(xml.childNodes).collect(function(ea){returnXMLConverter.xmlToJs(ea)});functionfirstKey(obj){returnObject.keys(obj).first()};childObjs.each(function(ea){baseObj[firstKey(baseObj)][firstKey(ea)]=ea[firstKey(ea)]});returnbaseObj;},xmlToJson:function(xml){returnXMLConverter.xmlToJs(xml)['#document']},//flattensXMLandcreatesstringrepresentationsforeachnodexmlToStringArray:function(xml,indent){if(!indent)indent='';//varobjCreator=function(string,xml){return{string:string,xml:xml,js:XMLConverter.xmlToJs(xml),isJSONConformant:true}};varobjCreator=function(string,xml){returnstring};if(!xml||xmlinstanceofDocumentType)return[];if(!xml.parentNode)returnXMLConverter.xmlToStringArray(xml.firstChild,indent);//omitrootif(!xml.hasChildNodes())return[objCreator(indent+Exporter.stringify(xml),xml)];varlist=$A(xml.childNodes).inject([],function(all,ea){returnall.concat(XMLConverter.xmlToStringArray(ea,indent+'\t'))});//getjustthetagopenerandcloserforthestringvarownXMLStrings=/(<.*?>).*(<.*?>)/.exec(Exporter.stringify(xml));list.unshift(objCreator(indent+ownXMLStrings[1],xml));list.push(objCreator(indent+ownXMLStrings[2],xml));returnlist;},xmlToString:function(xml,indent){if(!indent)indent='';if(!xml||xmlinstanceofDocumentType)return'';if(!xml.parentNode)returnXMLConverter.xmlToString(xml.firstChild,indent);//omitrootif(!xml.hasChildNodes())returnindent+Exporter.stringify(xml);varlist=$A(xml.childNodes).inject([],function(all,ea){returnall.concat(XMLConverter.xmlToString(ea,indent+'\t'))});//getjustthetagopenerandcloserforthestringvarownXMLStrings=/(<.*?>).*(<.*?>)/.exec(Exporter.stringify(xml));list.unshift(indent+ownXMLStrings[1]);list.push(indent+ownXMLStrings[2]);returnlist.join('\n');},};).*(<.*?>)/.exec(Exporter.stringify(xml));\n list.unshift(objCreator(indent + ownXMLStrings[1], xml));\n list.push(objCreator(indent + ownXMLStrings[2], xml));\n return list;\n },\n\n xmlToString: function(xml, indent) {\n if (!indent) indent = '';\n \n if (!xml || xml instanceof DocumentType) return '';\n if (!xml.parentNode) return XMLConverter.xmlToString(xml.firstChild, indent); // omit root\n if (!xml.hasChildNodes()) return indent + Exporter.stringify(xml);\n var list = $A(xml.childNodes).inject([], function(all, ea) {\n return all.concat(XMLConverter.xmlToString(ea, indent + '\\t')) });\n // get just the tag opener and closer for the string\n var ownXMLStrings = /(<.*?>).*(<.*?>)/.exec(Exporter.stringify(xml));\n list.unshift(indent + ownXMLStrings[1]);\n list.push(indent + ownXMLStrings[2]);\n return list.join('\\n');\n },\n};"]]>64truetrue2000000).*(<.*?>)/.exec(Exporter.stringify(xml));\n list.unshift(objCreator(indent + ownXMLStrings[1], xml));\n list.push(objCreator(indent + ownXMLStrings[2], xml));\n return list;\n },\n\n xmlToString: function(xml, indent) {\n if (!indent) indent = '';\n \n if (!xml || xml instanceof DocumentType) return '';\n if (!xml.parentNode) return XMLConverter.xmlToString(xml.firstChild, indent); // omit root\n if (!xml.hasChildNodes()) return indent + Exporter.stringify(xml);\n var list = $A(xml.childNodes).inject([], function(all, ea) {\n return all.concat(XMLConverter.xmlToString(ea, indent + '\\t')) });\n // get just the tag opener and closer for the string\n var ownXMLStrings = /(<.*?>).*(<.*?>)/.exec(Exporter.stringify(xml));\n list.unshift(indent + ownXMLStrings[1]);\n list.push(indent + ownXMLStrings[2]);\n return list.join('\\n');\n },\n};"]]>truetrue
1truetruetrue
Browseworld...falsenull
Pushchangesbackfalsenull
Refreshfalsenull
Evalonfalsenull
Sortfalsenull
truetruefalsenullnullnullnullfalsenull43