if (body instanceof ScriptBlock) {
ScriptBlock block = (ScriptBlock) body;
for (Iterator iter = block.getScriptList().iterator(); iter.hasNext();) {
Script script = (Script) iter.next();
if (script instanceof TagScript) {
TagScript tagScript = (TagScript) script;
Tag tag = tagScript.getTag();
if (tag instanceof WhenTag) {
whenTagList.add(tagScript);
}
else if (tag instanceof OtherwiseTag) {
otherwiseTag = tagScript;
break;
}
}
}
}
else if (body instanceof TagScript) {
// if only one child tag
TagScript tagScript = (TagScript) body;
Tag tag = tagScript.getTag();
if (tag instanceof WhenTag) {
whenTagList.add(tagScript);
}
else if (tag instanceof OtherwiseTag) {
otherwiseTag = tagScript;