You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by fe...@apache.org on 2002/10/02 13:27:25 UTC
cvs commit: xml-xindice/java/src/org/apache/xindice/core/xupdate XUpdateImpl.java
fern 2002/10/02 04:27:25
Modified: java/src/org/apache/xindice/core/xupdate XUpdateImpl.java
Log:
- XUpdate patch
- it should not throw exception at 0 node modification
Submitted by: Terry Rosenbaum
Revision Changes Path
1.4 +10 -6 xml-xindice/java/src/org/apache/xindice/core/xupdate/XUpdateImpl.java
Index: XUpdateImpl.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/src/org/apache/xindice/core/xupdate/XUpdateImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XUpdateImpl.java 23 Sep 2002 23:06:19 -0000 1.3
+++ XUpdateImpl.java 2 Oct 2002 11:27:25 -0000 1.4
@@ -129,7 +129,7 @@
Node origNode = contextNode;
CommandObject.getXPath().setNamespace(nsMap.getContextNode());
- while (commands.hasMoreElements() && contextNode != null) {
+ while (commands.hasMoreElements()) {
int id = ((Integer) commands.nextElement()).intValue();
if ( id == _commands.ATTRIBUTES ) {
@@ -155,14 +155,18 @@
}
catch(Exception e) {
// while not ideal, CommandObject.execute throws
- // Exception("no nodes selected!") if nothing is
+ // Exception("no nodes selected !") if nothing is
// selected for modification we trap that case
- // and ignore
- if( ! "no nodes selected!".equals(e.getMessage())) {
+ // and ignore allowing continued processing
+ // of remaining xupdate instructions that may be present
+ if( ! "no nodes selected !".equals(e.getMessage())) {
throw e;
}
- contextNode = null;
}
+ // default do-nothing command will soak up anything
+ // (characters, attributes, etc.) encountered until we
+ // come across the next xupdate instruction
+ // (e.g. remove, append, insert, etc.)
currentCommand = new DefaultCommand(contextNode);
}
}