@Override public XMLTag buildToXML() throws XMLWriteBackException { if (baseTag == null) { baseTag = new XMLTag("stage"); } if (log != null) baseTag.setAttribute("log", Boolean.toString(log)); if (closure != null) baseTag.setAttribute("closure", Boolean.toString(closure)); if (name != null) baseTag.addTag("name", name); if (comment != null) baseTag.addTag("comment", comment); return baseTag; }
/** * Sets the value for the tag/attribute found at TagPath. * * <p>If TagPath ends with "@<I>value</I>" then it will attempt to return the values of the * attribute <I>value</I> from the tags described in the first portion of TagPath. * * @param TagPath The path to the value to be returned. * @param _TagValue The new value. * @return The old value. */ public boolean setValue(String TagPath, String _TagValue) { // Returns true if the tagpath existed, false if it was created. if (TagPath.startsWith("@")) { String TempString = getAttribute(TagPath.substring(1)); setAttribute(TagPath.substring(1), _TagValue); if (TempString == null) { return false; } else { return true; } } String[] TempString = TagPath.split("/", 2); XMLTag TempTag = getTag(TempString[0]); if (TempString.length == 1) { if (TempTag == null) { addTag(TempString[0], _TagValue); return false; } else { return TempTag.setValue(_TagValue); } } else { if (TempTag == null) { TempTag = addTag(TempString[0]); } return TempTag.setValue(TempString[1], _TagValue); } }