From c2f52b9ee948150d1849f8ba3f088da41ce3b4c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 2 Jul 2008 20:22:25 +0200 Subject: [PATCH] return value with default value --- src/de/todesbaum/util/xml/SimpleXML.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/de/todesbaum/util/xml/SimpleXML.java b/src/de/todesbaum/util/xml/SimpleXML.java index a45f3d9..d42f13f 100644 --- a/src/de/todesbaum/util/xml/SimpleXML.java +++ b/src/de/todesbaum/util/xml/SimpleXML.java @@ -229,6 +229,18 @@ public class SimpleXML { } /** + * Returns the value of this node. If the node does not have a value, the + * given default value is returned. + * + *@param defaultValue + * The default value to return if the node does not have a value + * @return The value of this node + */ + public String getValue(String defaultValue) { + return (value == null) ? defaultValue : value; + } + + /** * Creates a {@link Document} from this node and all its child nodes. * * @return The {@link Document} created from this node -- 2.7.4