import tango.io.File; import tango.io.Stdout; import tango.text.xml.Document; import tango.net.http.HttpGet; void main () { auto doc = new Document!(char); // create the Document to parse into auto page = new HttpGet ("http://www.google.com/ig/api?weather=London"); auto content = cast (char[]) page.read; //read the xml from the internet into an array doc.parse (content); //parse the xml into a DOM-ish tree foreach( node; doc.query.descendant["forecast_conditions"]) //iterate over all forecast_condition elements in the document { Stdout.formatln("forecast for {} is {} with a high of {}", node.query["day_of_week"].attribute.nodes[0].value, //one way to access the first attribute's data from the day_of_week element node.query["condition"].nodes[0].getAttribute("data").value, //same way to access the data, this time from the condition element node.query["high"].nodes[0].getAttribute("data").value); //get the high for this forecast } }