elena       2002/09/24 08:13:09

  Modified:    java/src/org/apache/xerces/dom CoreDocumentImpl.java
  Log:
  Fixing bug: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12862
  The CoreDocumentImpl.importNode is used for both clonning and importing nodes, and
  we should differentiate between the two cases
  
  Revision  Changes    Path
  1.33      +11 -8     xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java
  
  Index: CoreDocumentImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/CoreDocumentImpl.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- CoreDocumentImpl.java     24 Sep 2002 13:44:37 -0000      1.32
  +++ CoreDocumentImpl.java     24 Sep 2002 15:13:09 -0000      1.33
  @@ -1499,7 +1499,6 @@
           // else
           
           int type = source.getNodeType();
  -
           switch (type) {
               case ELEMENT_NODE: {
                   Element newElement;
  @@ -1518,9 +1517,12 @@
                       for (int index = 0; index < length; index++) {
                           Attr attr = (Attr)sourceAttrs.item(index);
   
  -                        // Copy the attribute only if it is not a default.
  -                        if (attr.getSpecified()) {
  -                            Attr newAttr = (Attr)importNode(attr, true, false,
  +                        // NOTE: this methods is used for both importingNode
  +                        // and cloning the document node. In case of the 
  +                        // clonning default attributes should be copied.
  +                        // But for importNode defaults should be ignored.
  +                        if (attr.getSpecified() || cloningDoc) {
  +                            Attr newAttr = (Attr)importNode(attr, true, cloningDoc,
                                                             reversedIdentifiers);
   
                               // Attach attribute according to namespace
  @@ -1652,7 +1654,7 @@
                   NamedNodeMap tmap = newdoctype.getEntities();
                   if(smap != null) {
                       for(int i = 0; i < smap.getLength(); i++) {
  -                        tmap.setNamedItem(importNode(smap.item(i), true, false,
  +                        tmap.setNamedItem(importNode(smap.item(i), true, true,
                                                        reversedIdentifiers));
                       }
                   }
  @@ -1660,10 +1662,11 @@
                   tmap = newdoctype.getNotations();
                   if (smap != null) {
                       for(int i = 0; i < smap.getLength(); i++) {
  -                        tmap.setNamedItem(importNode(smap.item(i), true, false,
  +                        tmap.setNamedItem(importNode(smap.item(i), true, true,
                                                        reversedIdentifiers));
                       }
                   }
  +                
                   // NOTE: At this time, the DOM definition of DocumentType
                   // doesn't cover Elements and their Attributes. domimpl's
                   // extentions in that area will not be preserved, even if
  @@ -1704,7 +1707,7 @@
               for (Node srckid = source.getFirstChild();
                    srckid != null;
                    srckid = srckid.getNextSibling()) {
  -                newnode.appendChild(importNode(srckid, true, false,
  +                newnode.appendChild(importNode(srckid, true, cloningDoc,
                                                  reversedIdentifiers));
               }
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to