mirror of
https://github.com/processing/processing4.git
synced 2026-04-18 10:19:18 +02:00
two quick XML example fixes
This commit is contained in:
@@ -94,7 +94,7 @@ void mousePressed() {
|
||||
// Set the diameter element
|
||||
XML diameter = bubble.addChild("diameter");
|
||||
// Here for a node's content, we have to convert to a String
|
||||
diameter.setContent("" + random(40,80));
|
||||
diameter.setFloatContent(random(40,80));
|
||||
|
||||
// Set a label
|
||||
XML label = bubble.addChild("label");
|
||||
|
||||
@@ -29,7 +29,7 @@ void setup() {
|
||||
XML xml = loadXML(url);
|
||||
|
||||
// Grab the element we want
|
||||
XML forecast = xml.getChild("channel").getChild("item").getChild("yweather:forecast");
|
||||
XML forecast = xml.getChild("channel/item/yweather:forecast");
|
||||
|
||||
// Get the attributes we want
|
||||
temperature = forecast.getInt("high");
|
||||
|
||||
Reference in New Issue
Block a user