From: Wolfgang M. M. <wol...@us...> - 2004-08-09 10:24:42
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1996/src/org/exist/dom Modified Files: ElementImpl.java Log Message: Fixed: append an attribute to an element. Added corresponding XUpdate test cases. Index: ElementImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/ElementImpl.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** ElementImpl.java 12 Jul 2004 17:17:40 -0000 1.44 --- ElementImpl.java 9 Aug 2004 10:24:31 -0000 1.45 *************** *** 281,288 **** } else { NodeImpl lastAttrib = getLastAttribute(); ! if(lastAttrib.gid == lastChildID()) node = appendChildren(lastChildID() + 1, lastAttrib, getPath(), attribs, true); else ! node = insertAfter(attribs, lastAttrib); } ownerDocument.broker.update(this); --- 281,288 ---- } else { NodeImpl lastAttrib = getLastAttribute(); ! if(lastAttrib != null && lastAttrib.gid == lastChildID()) node = appendChildren(lastChildID() + 1, lastAttrib, getPath(), attribs, true); else ! node = appendChildren(firstChildID() + 1, this, getPath(), attribs, true); } ownerDocument.broker.update(this); *************** *** 1112,1120 **** */ public Node insertAfter(NodeList nodes, Node refChild) throws DOMException { - if (!(refChild instanceof NodeImpl)) - throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "wrong node type"); - final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); if (refChild == null) return appendChildren(nodes, -1); final NodeImpl ref = (NodeImpl) refChild; final long first = firstChildID(); --- 1112,1120 ---- */ public Node insertAfter(NodeList nodes, Node refChild) throws DOMException { if (refChild == null) return appendChildren(nodes, -1); + if (!(refChild instanceof NodeImpl)) + throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "wrong node type: "); + final DocumentImpl prevDoc = new DocumentImpl(ownerDocument); final NodeImpl ref = (NodeImpl) refChild; final long first = firstChildID(); |