From 99eef5107b4296c71019e32335d16b3c4d4619ee Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Mon, 12 Aug 2013 17:22:06 -0400 Subject: [PATCH] add getContent(defaultValue) to XML --- core/src/processing/data/XML.java | 6 ++++++ core/todo.txt | 1 + 2 files changed, 7 insertions(+) diff --git a/core/src/processing/data/XML.java b/core/src/processing/data/XML.java index b345465e3..28023b768 100644 --- a/core/src/processing/data/XML.java +++ b/core/src/processing/data/XML.java @@ -810,6 +810,12 @@ public class XML implements Serializable { } + public String getContent(String defaultValue) { + String s = node.getTextContent(); + return (s != null) ? s : defaultValue; + } + + /** * @webref xml:method * @brief Gets the content of an element as an int diff --git a/core/todo.txt b/core/todo.txt index 82e694752..cf07a64ed 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -29,6 +29,7 @@ X when using increment() on IntList, make sure the index exists X automatically resize the list if necessary X (this is more in keeping with increment() in the Dict classes) X add join() method to Int/Float/StringList +X add getContent(defaultValue) to XML cleaning X load/save methods.. is it save("blah.svg") or saveSVG("blah.svg")