309,7 → 309,7 |
Element e = (Element)subnode; |
|
if(testElement(element, params, e)) { |
if(element.getIndex() >= 0) |
if(element.getIndex() > 0) |
idxElements.add(0, e); // if index specified then collect all desired nodes to list |
else |
return doStep(path, ++pos, params, e, update); // otherwise go to the node immed. |
317,9 → 317,9 |
} |
|
// if index specified, test the collected desired items |
if(element.getIndex() >= 0) { |
if(element.getIndex() < idxElements.size()) // go to the node |
return doStep(path, ++pos, params, (Element)idxElements.get(element.getIndex()), update); |
if(element.getIndex() > 0) { |
if(element.getIndex() <= idxElements.size()) // go to the node |
return doStep(path, ++pos, params, (Element)idxElements.get(element.getIndex()-1), update); |
} |
} |
|
330,8 → 330,8 |
|
Element newElement = null; |
|
if(element.getIndex() >= 0) { |
for(int i = idxElements.size(); i <= element.getIndex(); i++) { |
if(element.getIndex() > 0) { |
for(int i = idxElements.size()+1; i <= element.getIndex(); i++) { |
newElement = createNewElement(element, params, node); // we need the last one only |
} |
} |
385,6 → 385,10 |
|
// get second value |
switch(condition.getSecondOperandType()) { |
case PathElement.OPERAND_NONE: |
value = null; |
break; |
|
case PathElement.OPERAND_VARIABLE: |
value = (String)params.get(condition.getSecondOperandValue()); |
break; |
400,6 → 404,10 |
|
// set |
switch(condition.getOperation()) { |
case PathElement.OPERATION_EXIST: |
subnode.setNodeValue(""); |
break; |
|
case PathElement.OPERATION_EQUAL: |
subnode.setNodeValue(value); |
break; |
439,7 → 447,11 |
break; |
|
case PathElement.OPERAND_ATTRIBUTE: |
firstValue = node.getAttribute(condition.getFirstOperandValue()); |
Attr attr = node.getAttributeNode(condition.getFirstOperandValue()); |
if(attr == null) |
firstValue = null; |
else |
firstValue = node.getAttribute(condition.getFirstOperandValue()); |
break; |
|
default: |
449,6 → 461,10 |
|
// get second value |
switch(condition.getSecondOperandType()) { |
case PathElement.OPERAND_NONE: |
secondValue = null; |
break; |
|
case PathElement.OPERAND_VARIABLE: |
secondValue = (String)params.get(condition.getSecondOperandValue()); |
break; |
464,8 → 480,13 |
|
// compare |
switch(condition.getOperation()) { |
case PathElement.OPERATION_EXIST: |
if(firstValue == null) return false; |
break; |
|
case PathElement.OPERATION_EQUAL: |
if(!firstValue.equals(secondValue)) return false; |
if(firstValue == null || secondValue == null || !firstValue.equals(secondValue)) |
return false; |
break; |
|
default: |
566,10 → 587,10 |
|
// text indices |
tree.updateDocument( |
"/Vertrag/i# := '0'", |
"/Vertrag/i# := '1'", |
null); |
tree.updateDocument( |
"/Vertrag/i[1]# := '1'", |
"/Vertrag/i[2]@id := '2'", |
null); |
tree.updateDocument( |
"/Vertrag/i[7]# := '7'", |
578,6 → 599,15 |
"/Vertrag/i[4]# := '4'", |
null); |
|
// test existence of attributes |
tree.updateDocument( |
"/Vertrag/i[@id]# := '2_2'", |
null); |
|
tree.updateDocument( |
"/Vertrag/i[@id2]# := '2_2'", |
null); |
|
// test search ------------------------------------------------------------- |
|
tree.searchElement("/Vertrag/Sparten", (Object[])null); |