mrglavas 2004/04/15 11:38:22 Modified: java/src/org/apache/xerces/dom PSVIDocumentImpl.java Log: Fixing Jira Bug #923:
http://nagoya.apache.org/jira/browse/XERCESJ-923 PSVIDocumentImpl did not override cloneNode so an instance of its parent DocumentImpl was returned from this method instead of a new instance of PSVIDocumentImpl. This is now fixed thanks to the patch by Neil Delima. Revision Changes Path 1.9 +24 -1 xml-xerces/java/src/org/apache/xerces/dom/PSVIDocumentImpl.java Index: PSVIDocumentImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/PSVIDocumentImpl.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- PSVIDocumentImpl.java 24 Feb 2004 23:23:17 -0000 1.8 +++ PSVIDocumentImpl.java 15 Apr 2004 18:38:22 -0000 1.9 @@ -24,6 +24,7 @@ // REVISIT: This is a HACK! DO NOT MODIFY THIS import. // It allows us to expose DOM L3 implemenation via org.w3c.dom packages import org.apache.xerces.dom3.DOMConfiguration; +import org.apache.xerces.dom3.UserDataHandler; import org.w3c.dom.*; /** @@ -54,6 +55,28 @@ super(doctype); } + /** + * Deep-clone a document, including fixing ownerDoc for the cloned + * children. Note that this requires bypassing the WRONG_DOCUMENT_ERR + * protection. I've chosen to implement it by calling importNode + * which is DOM Level 2. + * + * @return org.w3c.dom.Node + * @param deep boolean, iff true replicate children + */ + public Node cloneNode(boolean deep) { + + PSVIDocumentImpl newdoc = new PSVIDocumentImpl(); + callUserDataHandlers(this, newdoc, UserDataHandler.NODE_CLONED); + cloneNode(newdoc, deep); + + // experimental + newdoc.mutationEvents = mutationEvents; + + return newdoc; + + } // cloneNode(boolean):Node + /** * Retrieve information describing the abilities of this particular * DOM implementation. Intended to support applications that may be --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]