* <!ELEMENT and_selection (selection_metadata | and_selection | or_selection | not_selection)+>
* @see org.olat.qti.process.elements.ExpressionBuilder#buildXPathExpression(org.dom4j.Element, java.lang.StringBuilder)
*/
public void buildXPathExpression(Element selectionElement, StringBuilder expr, boolean not_switch, boolean use_switch) {
if (use_switch && not_switch) { // treat this "and" node as an "or" node (we need to propagate not's down the tree, since xpath only knows !=,< etc. , but not a not
ExpressionBuilder eb = QTIHelper.getExpressionBuilder("or_selection");
eb.buildXPathExpression(selectionElement, expr, not_switch, false);
}
else {
List elems = selectionElement.elements();
int size = elems.size(); // dtd: > 0
for (int i = 0; i < size; i++) {
Element child = (Element)elems.get(i);
String name = child.getName();
ExpressionBuilder eb = QTIHelper.getExpressionBuilder(name);
eb.buildXPathExpression(child, expr, not_switch, true);
if (i < size -1) expr.append(" and ");
}
}
}