From: Wolfgang M. M. <wol...@us...> - 2004-04-30 09:07:48
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23662/src/org/exist/dom Modified Files: ElementImpl.java NodeImpl.java Log Message: XUpdate: added missing support for optional child attribute in xupdate:append. Index: ElementImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/ElementImpl.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ElementImpl.java 27 Apr 2004 15:46:56 -0000 1.31 --- ElementImpl.java 30 Apr 2004 09:07:31 -0000 1.32 *************** *** 265,269 **** } ! public Node appendChildren(NodeList nodes) throws DOMException { DocumentImpl prevDoc = new DocumentImpl(ownerDocument); Node node = null; --- 265,269 ---- } ! public Node appendChildren(NodeList nodes, int child) throws DOMException { DocumentImpl prevDoc = new DocumentImpl(ownerDocument); Node node = null; *************** *** 271,281 **** node = appendChildren(firstChildID(), this, nodes, true); else { ! long last = lastChildID(); ! NodeImpl lastNode = getLastNode((NodeImpl) ownerDocument.getNode(last)); ! if (lastNode == null) ! throw new DOMException( ! DOMException.HIERARCHY_REQUEST_ERR, ! "invalid node: null"); ! node = appendChildren(last + 1, lastNode, nodes, true); } ownerDocument.broker.update(this); --- 271,289 ---- node = appendChildren(firstChildID(), this, nodes, true); else { ! if(child == 1) { ! Node firstChild = getFirstChild(); ! insertBefore(nodes, firstChild); ! } else { ! NodeImpl prevNode; ! long pos = firstChildID(); ! if(0 < child && child <= children) { ! pos = firstChildID() + child - 2; ! prevNode = getLastNode((NodeImpl) ownerDocument.getNode(pos)); ! node = insertAfter(nodes, prevNode); ! } else { ! prevNode = getLastNode((NodeImpl) ownerDocument.getNode(lastChildID())); ! node = appendChildren(lastChildID() + 1, prevNode, nodes, true); ! } ! } } ownerDocument.broker.update(this); *************** *** 994,998 **** DocumentImpl prevDoc = new DocumentImpl(ownerDocument); if (refChild == null) ! return appendChildren(nodes); NodeImpl ref = (NodeImpl) refChild; final long first = firstChildID(); --- 1002,1006 ---- DocumentImpl prevDoc = new DocumentImpl(ownerDocument); if (refChild == null) ! return appendChildren(nodes, -1); NodeImpl ref = (NodeImpl) refChild; final long first = firstChildID(); *************** *** 1029,1033 **** final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); if (refChild == null) ! return appendChildren(nodes); final NodeImpl ref = (NodeImpl) refChild; final long first = firstChildID(); --- 1037,1041 ---- final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); if (refChild == null) ! return appendChildren(nodes, -1); final NodeImpl ref = (NodeImpl) refChild; final long first = firstChildID(); Index: NodeImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/NodeImpl.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** NodeImpl.java 27 Apr 2004 15:46:56 -0000 1.17 --- NodeImpl.java 30 Apr 2004 09:07:32 -0000 1.18 *************** *** 163,167 **** } ! public Node appendChildren(NodeList nodes) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "not implemented"); } --- 163,167 ---- } ! public Node appendChildren(NodeList nodes, int child) throws DOMException { throw new DOMException(DOMException.NOT_SUPPORTED_ERR, "not implemented"); } |