From: Wolfgang M. M. <wol...@us...> - 2004-06-16 13:37:05
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12518/src/org/exist/xupdate Modified Files: Append.java Insert.java XUpdateProcessor.java Rename.java Modification.java Update.java Log Message: Adding an attribute through xupdate didn't work. Index: XUpdateProcessor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/XUpdateProcessor.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** XUpdateProcessor.java 18 May 2004 14:18:46 -0000 1.23 --- XUpdateProcessor.java 16 Jun 2004 13:36:53 -0000 1.24 *************** *** 19,22 **** --- 19,23 ---- import org.apache.log4j.Logger; import org.exist.dom.DocumentSet; + import org.exist.dom.NodeListImpl; import org.exist.dom.XMLUtil; import org.exist.xquery.parser.XQueryLexer; *************** *** 63,66 **** --- 64,69 ---- private final static Logger LOG = Logger.getLogger(XUpdateProcessor.class); + private NodeListImpl contents = null; + private boolean inModification = false; private boolean inAttribute = false; *************** *** 68,72 **** private DocumentBuilder builder; private Document doc; - private DocumentFragment fragment = null; private Stack stack = new Stack(); private Node currentNode = null; --- 71,74 ---- *************** *** 179,183 **** if (stack.isEmpty()) { //LOG.debug("appending text to fragment: " + text.getData()); ! fragment.appendChild(text); } else { Element last = (Element) stack.peek(); --- 181,185 ---- if (stack.isEmpty()) { //LOG.debug("appending text to fragment: " + text.getData()); ! contents.add(text); } else { Element last = (Element) stack.peek(); *************** *** 229,233 **** localName + " requires a select attribute"); doc = builder.newDocument(); ! fragment = doc.createDocumentFragment(); inModification = true; } else if ( --- 231,235 ---- localName + " requires a select attribute"); doc = builder.newDocument(); ! contents = new NodeListImpl(); inModification = true; } else if ( *************** *** 282,286 **** elem.setPrefix(prefix); if (stack.isEmpty()) { ! fragment.appendChild(elem); } else { Element last = (Element) stack.peek(); --- 284,288 ---- elem.setPrefix(prefix); if (stack.isEmpty()) { ! contents.add(elem); } else { Element last = (Element) stack.peek(); *************** *** 307,311 **** Attr attrib = doc.createAttributeNS(namespace, name); if (stack.isEmpty()) ! fragment.appendChild(attrib); else { Element last = (Element) stack.peek(); --- 309,313 ---- Attr attrib = doc.createAttributeNS(namespace, name); if (stack.isEmpty()) ! contents.add(attrib); else { Element last = (Element) stack.peek(); *************** *** 333,337 **** node = XMLUtil.copyNode(doc, (Node) i.next()); if (stack.isEmpty()) ! fragment.appendChild(node); else { Element last = (Element) stack.peek(); --- 335,339 ---- node = XMLUtil.copyNode(doc, (Node) i.next()); if (stack.isEmpty()) ! contents.add(node); else { Element last = (Element) stack.peek(); *************** *** 349,353 **** } if (stack.isEmpty()) { ! fragment.appendChild(elem); } else { Element last = (Element) stack.peek(); --- 351,355 ---- } if (stack.isEmpty()) { ! contents.add(elem); } else { Element last = (Element) stack.peek(); *************** *** 369,373 **** Text text = doc.createTextNode(normalized); if (stack.isEmpty()) { ! fragment.appendChild(text); } else { Element last = (Element) stack.peek(); --- 371,375 ---- Text text = doc.createTextNode(normalized); if (stack.isEmpty()) { ! contents.add(text); } else { Element last = (Element) stack.peek(); *************** *** 389,393 **** || localName.equals("insert-after")) { inModification = false; ! modification.setContent(fragment); modifications.add(modification); modification = null; --- 391,395 ---- || localName.equals("insert-after")) { inModification = false; ! modification.setContent(contents); modifications.add(modification); modification = null; *************** *** 436,440 **** if (stack.isEmpty()) { LOG.debug("appending text to fragment: " + text.getData()); ! fragment.appendChild(text); } else { Element last = (Element) stack.peek(); --- 438,442 ---- if (stack.isEmpty()) { LOG.debug("appending text to fragment: " + text.getData()); ! contents.add(text); } else { Element last = (Element) stack.peek(); *************** *** 448,452 **** doc.createProcessingInstruction(target, data); if (stack.isEmpty()) { ! fragment.appendChild(pi); } else { Element last = (Element) stack.peek(); --- 450,454 ---- doc.createProcessingInstruction(target, data); if (stack.isEmpty()) { ! contents.add(pi); } else { Element last = (Element) stack.peek(); *************** *** 530,534 **** if (stack.isEmpty()) { //LOG.debug("appending text to fragment: " + text.getData()); ! fragment.appendChild(text); } else { Element last = (Element) stack.peek(); --- 532,536 ---- if (stack.isEmpty()) { //LOG.debug("appending text to fragment: " + text.getData()); ! contents.add(text); } else { Element last = (Element) stack.peek(); *************** *** 541,545 **** Comment comment = doc.createComment(new String(ch, start, length)); if (stack.isEmpty()) { ! fragment.appendChild(comment); } else { Element last = (Element) stack.peek(); --- 543,547 ---- Comment comment = doc.createComment(new String(ch, start, length)); if (stack.isEmpty()) { ! contents.add(comment); } else { Element last = (Element) stack.peek(); *************** *** 591,595 **** modification = null; doc = null; ! fragment = null; stack.clear(); currentNode = null; --- 593,597 ---- modification = null; doc = null; ! contents = null; stack.clear(); currentNode = null; Index: Update.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Update.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Update.java 25 May 2004 09:26:03 -0000 1.14 --- Update.java 16 Jun 2004 13:36:53 -0000 1.15 *************** *** 65,69 **** public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content.getChildNodes(); if (children.getLength() == 0) return 0; --- 65,69 ---- public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content; if (children.getLength() == 0) return 0; Index: Insert.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Insert.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Insert.java 25 May 2004 09:26:03 -0000 1.14 --- Insert.java 16 Jun 2004 13:36:53 -0000 1.15 *************** *** 71,75 **** public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content.getChildNodes(); if (children.getLength() == 0) return 0; try { --- 71,75 ---- public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content; if (children.getLength() == 0) return 0; try { Index: Modification.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Modification.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Modification.java 16 Jun 2004 09:21:32 -0000 1.26 --- Modification.java 16 Jun 2004 13:36:53 -0000 1.27 *************** *** 67,71 **** protected String selectStmt = null; ! protected DocumentFragment content = null; protected DBBroker broker; protected DocumentSet docs; --- 67,71 ---- protected String selectStmt = null; ! protected NodeList content = null; protected DBBroker broker; protected DocumentSet docs; *************** *** 99,104 **** public abstract String getName(); ! public void setContent(DocumentFragment node) { ! content = node; } --- 99,104 ---- public abstract String getName(); ! public void setContent(NodeList nodes) { ! content = nodes; } *************** *** 209,213 **** buf.append(selectStmt); buf.append("\">"); ! buf.append(XMLUtil.dump(content)); buf.append("</xu:"); buf.append(getName()); --- 209,213 ---- buf.append(selectStmt); buf.append("\">"); ! // buf.append(XMLUtil.dump(content)); buf.append("</xu:"); buf.append(getName()); Index: Append.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Append.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Append.java 25 May 2004 09:26:03 -0000 1.16 --- Append.java 16 Jun 2004 13:36:53 -0000 1.17 *************** *** 64,68 **** public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content.getChildNodes(); if(children.getLength() == 0) return 0; --- 64,68 ---- public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content; if(children.getLength() == 0) return 0; Index: Rename.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Rename.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Rename.java 25 May 2004 09:26:03 -0000 1.14 --- Rename.java 16 Jun 2004 13:36:53 -0000 1.15 *************** *** 63,67 **** public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content.getChildNodes(); if (children.getLength() == 0) return 0; int modificationCount = 0; --- 63,67 ---- public long process() throws PermissionDeniedException, LockException, EXistException, XPathException { ! NodeList children = content; if (children.getLength() == 0) return 0; int modificationCount = 0; |