You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@locus.apache.org on 2000/01/08 01:09:30 UTC

cvs commit: xml-xerces/c/src/dom DocumentImpl.cpp DocumentTypeImpl.cpp DocumentTypeImpl.hpp EntityReferenceImpl.cpp NamedNodeMapImpl.cpp NamedNodeMapImpl.hpp NodeImpl.cpp

andyh       00/01/07 16:09:30

  Modified:    c/src/dom DocumentImpl.cpp DocumentTypeImpl.cpp
                        DocumentTypeImpl.hpp EntityReferenceImpl.cpp
                        NamedNodeMapImpl.cpp NamedNodeMapImpl.hpp
                        NodeImpl.cpp
  Log:
  Correcf failures in DOMTest with entity references and read-only nodes.
  Correct reference counting problem NamedNodeMap.
  Add export methods to NamedNodeMap and DocumentTypeImpl.
  Redo DocumentImpl::cloneNode
  
  (Changes by Chih-Hsiang Chou)
  
  Revision  Changes    Path
  1.4       +25 -6     xml-xerces/c/src/dom/DocumentImpl.cpp
  
  Index: DocumentImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/DocumentImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DocumentImpl.cpp	2000/01/05 01:16:08	1.3
  +++ DocumentImpl.cpp	2000/01/08 00:09:27	1.4
  @@ -56,6 +56,14 @@
   
   /**
    * $Log: DocumentImpl.cpp,v $
  + * Revision 1.4  2000/01/08 00:09:27  andyh
  + * Correcf failures in DOMTest with entity references and read-only nodes.
  + * Correct reference counting problem NamedNodeMap.
  + * Add export methods to NamedNodeMap and DocumentTypeImpl.
  + * Redo DocumentImpl::cloneNode
  + *
  + * (Changes by Chih-Hsiang Chou)
  + *
    * Revision 1.3  2000/01/05 01:16:08  andyh
    * DOM Level 2 core, namespace support added.
    *
  @@ -125,8 +133,10 @@
           throw DOM_DOMException(	//one doctype can belong to only one DocumentImpl
   	    DOM_DOMException::WRONG_DOCUMENT_ERR, null);
       docType=doctype;
  -    if (doctype != null)
  +    if (doctype != null) {
   	doctype -> setOwnerDocument(this);
  +	appendChild(doctype);
  +    }
       docElement=null;
       namePool = new DStringPool(257);
       iterators = 0L;
  @@ -154,11 +164,22 @@
   
   
   NodeImpl *DocumentImpl::cloneNode(bool deep) {
  -    DocumentImpl *newdoc=new DocumentImpl();
  +    bool ns = localName != null;    //true if namespace involved, i.e. DOM Level 2 and after
  +    DocumentImpl *newdoc = ns ? new DocumentImpl(namespaceURI, name, null) : new DocumentImpl();
       if (deep)
  -        for(NodeImpl *n=getFirstChild();n!=null;n=n->getNextSibling())
  -            newdoc->appendChild(newdoc->importNode(n,true));
  -        return newdoc;
  +        for (NodeImpl *n=getFirstChild(); n!=null; n=n->getNextSibling()) {
  +	    if (n -> isDocumentTypeImpl()) {
  +		DocumentTypeImpl *doctype = ((DocumentTypeImpl *)n) -> export(newdoc, true);
  +		newdoc -> appendChild(doctype);
  +		newdoc -> docType = doctype;
  +	    } else if (n -> isElementImpl()) {
  +		ElementImpl *docelem = (ElementImpl *) newdoc -> importNode(n, true);
  +		newdoc -> appendChild(docelem);
  +		newdoc -> docElement = docelem;
  +	    } else
  +		newdoc -> appendChild(newdoc->importNode(n,true));
  +	}
  +    return newdoc;
   };
   
   bool DocumentImpl::isDocumentImpl() {
  @@ -489,7 +510,8 @@
           break;
       case DOM_Node::ENTITY_REFERENCE_NODE :
           newnode = createEntityReference(source->getNodeName());
  -        deep=false; // ????? Right Thing?
  +	newnode -> readOnly = false; //allow deep copy temporarily
  +//        deep=false; // ????? Right Thing?
           // Value implied by doctype, so we should not copy it
           // -- instead, refer to local doctype, if any.
           break;
  @@ -535,6 +557,8 @@
           {
               newnode->appendChild(importNode(srckid, true));
           }
  +    if (newnode -> getNodeType() == DOM_Node::ENTITY_REFERENCE_NODE)
  +	newnode -> readOnly = true;
   
       return newnode;
   };
  
  
  
  1.3       +33 -6     xml-xerces/c/src/dom/DocumentTypeImpl.cpp
  
  Index: DocumentTypeImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/DocumentTypeImpl.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DocumentTypeImpl.cpp	1999/11/30 21:16:25	1.2
  +++ DocumentTypeImpl.cpp	2000/01/08 00:09:28	1.3
  @@ -56,6 +56,14 @@
   
   /**
    * $Log: DocumentTypeImpl.cpp,v $
  + * Revision 1.3  2000/01/08 00:09:28  andyh
  + * Correcf failures in DOMTest with entity references and read-only nodes.
  + * Correct reference counting problem NamedNodeMap.
  + * Add export methods to NamedNodeMap and DocumentTypeImpl.
  + * Redo DocumentImpl::cloneNode
  + *
  + * (Changes by Chih-Hsiang Chou)
  + *
    * Revision 1.2  1999/11/30 21:16:25  roddey
    * Changes to add the transcode() method to DOMString, which returns a transcoded
    * version (to local code page) of the DOM string contents. And I changed all of the
  @@ -113,9 +121,9 @@
       elements = other.elements->cloneMap();
   
       //DOM Level 2
  -    publicID = other.publicID;
  -    systemID = other.systemID;
  -    internalSubset = other.internalSubset;
  +    publicID = other.publicID.clone();
  +    systemID = other.systemID.clone();
  +    internalSubset = other.internalSubset.clone();
   };
   
   
  @@ -127,15 +135,12 @@
           NamedNodeMapImpl::removeRef(entities);
       }
   
  -
       if (notations != null)
       {
           notations->removeAll();
           NamedNodeMapImpl::removeRef(notations);
       }
   
  -
  -
       if (elements != null)
       {
           elements->removeAll();
  @@ -219,4 +224,29 @@
   void DocumentTypeImpl::setOwnerDocument(DocumentImpl *docImpl)
   {
       ownerDocument = docImpl;
  +    //Note: ownerDoc of entities, notations and elements remain unchanged
  +    //The DOM APIs does not require a NamedNodeMap to have an owner document
  +}
  +
  +
  +/** Export this node to a different document docImpl.
  + */
  +DocumentTypeImpl *DocumentTypeImpl::export(DocumentImpl *docImpl, bool deep)
  +{
  +    DocumentTypeImpl *doctype;
  +    if (localName != null) {	//true if namespace involved, i.e. DOM Level 2 and after
  +	doctype = new DocumentTypeImpl(name, publicID, systemID, internalSubset);
  +	doctype -> setOwnerDocument(docImpl);
  +    } else
  +	doctype = new DocumentTypeImpl(docImpl, name);
  +    if (deep) {
  +	delete doctype -> entities;
  +	delete doctype -> notations;
  +	delete doctype -> elements;
  +	doctype -> entities = entities -> export(docImpl);
  +	doctype -> notations = notations -> export(docImpl);
  +	doctype -> elements = elements -> export(docImpl);
  +    }
  +    return doctype;
   }
  +
  
  
  
  1.3       +10 -1     xml-xerces/c/src/dom/DocumentTypeImpl.hpp
  
  Index: DocumentTypeImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/DocumentTypeImpl.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DocumentTypeImpl.hpp	1999/12/21 07:47:06	1.2
  +++ DocumentTypeImpl.hpp	2000/01/08 00:09:28	1.3
  @@ -59,6 +59,14 @@
   
   /**
    * $Log: DocumentTypeImpl.hpp,v $
  + * Revision 1.3  2000/01/08 00:09:28  andyh
  + * Correcf failures in DOMTest with entity references and read-only nodes.
  + * Correct reference counting problem NamedNodeMap.
  + * Add export methods to NamedNodeMap and DocumentTypeImpl.
  + * Redo DocumentImpl::cloneNode
  + *
  + * (Changes by Chih-Hsiang Chou)
  + *
    * Revision 1.2  1999/12/21 07:47:06  robweir
    * Patches to support Xalan, where we need to create a
    * "special" DOM with subclassed Nodes.
  @@ -120,7 +128,9 @@
       virtual DOMString     getPublicID();
       virtual DOMString     getSystemID();
       virtual DOMString     getInternalSubset();
  -    virtual void setOwnerDocument(DocumentImpl *docImpl); //internal use only
  +    //internal use only
  +    virtual void setOwnerDocument(DocumentImpl *docImpl);
  +    virtual DocumentTypeImpl *export(DocumentImpl *docImpl, bool deep);
   };
   
   #endif
  
  
  
  1.3       +101 -85   xml-xerces/c/src/dom/EntityReferenceImpl.cpp
  
  Index: EntityReferenceImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/EntityReferenceImpl.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- EntityReferenceImpl.cpp	1999/11/30 21:16:25	1.2
  +++ EntityReferenceImpl.cpp	2000/01/08 00:09:28	1.3
  @@ -1,75 +1,83 @@
   /*
  - * The Apache Software License, Version 1.1
  - * 
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  - * reserved.
  - * 
  - * Redistribution and use in source and binary forms, with or without
  - * modification, are permitted provided that the following conditions
  - * are met:
  - * 
  - * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  - * 
  - * 2. Redistributions in binary form must reproduce the above copyright
  - *    notice, this list of conditions and the following disclaimer in
  - *    the documentation and/or other materials provided with the
  - *    distribution.
  - * 
  - * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  - *       "This product includes software developed by the
  - *        Apache Software Foundation (http://www.apache.org/)."
  - *    Alternately, this acknowledgment may appear in the software itself,
  - *    if and wherever such third-party acknowledgments normally appear.
  - * 
  - * 4. The names "Xerces" and "Apache Software Foundation" must
  - *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  - *    permission, please contact apache\@apache.org.
  - * 
  - * 5. Products derived from this software may not be called "Apache",
  - *    nor may "Apache" appear in their name, without prior written
  - *    permission of the Apache Software Foundation.
  - * 
  - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  - * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  - * SUCH DAMAGE.
  - * ====================================================================
  - * 
  - * This software consists of voluntary contributions made by many
  - * individuals on behalf of the Apache Software Foundation, and was
  - * originally based on software copyright (c) 1999, International
  - * Business Machines, Inc., http://www.ibm.com .  For more information
  - * on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  -
  -/**
  - * $Log: EntityReferenceImpl.cpp,v $
  - * Revision 1.2  1999/11/30 21:16:25  roddey
  - * Changes to add the transcode() method to DOMString, which returns a transcoded
  - * version (to local code page) of the DOM string contents. And I changed all of the
  - * exception 'throw by pointer' to 'throw by value' style.
  - *
  - * Revision 1.1.1.1  1999/11/09 01:09:09  twl
  - * Initial checkin
  - *
  - * Revision 1.2  1999/11/08 20:44:27  rahul
  - * Swat for adding in Product name and CVS comment log variable.
  - *
  +* The Apache Software License, Version 1.1
  +* 
  +* Copyright (c) 1999 The Apache Software Foundation.  All rights 
  +* reserved.
  +* 
  +* Redistribution and use in source and binary forms, with or without
  +* modification, are permitted provided that the following conditions
  +* are met:
  +* 
  +* 1. Redistributions of source code must retain the above copyright
  +*    notice, this list of conditions and the following disclaimer. 
  +* 
  +* 2. Redistributions in binary form must reproduce the above copyright
  +*    notice, this list of conditions and the following disclaimer in
  +*    the documentation and/or other materials provided with the
  +*    distribution.
  +* 
  +* 3. The end-user documentation included with the redistribution,
  +*    if any, must include the following acknowledgment:  
  +*       "This product includes software developed by the
  +*        Apache Software Foundation (http://www.apache.org/)."
  +*    Alternately, this acknowledgment may appear in the software itself,
  +*    if and wherever such third-party acknowledgments normally appear.
  +* 
  +* 4. The names "Xerces" and "Apache Software Foundation" must
  +*    not be used to endorse or promote products derived from this
  +*    software without prior written permission. For written 
  +*    permission, please contact apache\@apache.org.
  +* 
  +* 5. Products derived from this software may not be called "Apache",
  +*    nor may "Apache" appear in their name, without prior written
  +*    permission of the Apache Software Foundation.
  +* 
  +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  +* DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  +* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  +* SUCH DAMAGE.
  +* ====================================================================
  +* 
  +* This software consists of voluntary contributions made by many
  +* individuals on behalf of the Apache Software Foundation, and was
  +* originally based on software copyright (c) 1999, International
  +* Business Machines, Inc., http://www.ibm.com .  For more information
  +* on the Apache Software Foundation, please see
  +* <http://www.apache.org/>.
   */
   
   /**
  +* $Log: EntityReferenceImpl.cpp,v $
  +* Revision 1.3  2000/01/08 00:09:28  andyh
  +* Correcf failures in DOMTest with entity references and read-only nodes.
  +* Correct reference counting problem NamedNodeMap.
  +* Add export methods to NamedNodeMap and DocumentTypeImpl.
  +* Redo DocumentImpl::cloneNode
  +*
  +* (Changes by Chih-Hsiang Chou)
  +*
  +* Revision 1.2  1999/11/30 21:16:25  roddey
  +* Changes to add the transcode() method to DOMString, which returns a transcoded
  +* version (to local code page) of the DOM string contents. And I changed all of the
  +* exception 'throw by pointer' to 'throw by value' style.
  +*
  +* Revision 1.1.1.1  1999/11/09 01:09:09  twl
  +* Initial checkin
  +*
  +* Revision 1.2  1999/11/08 20:44:27  rahul
  +* Swat for adding in Product name and CVS comment log variable.
  +*
  +*/
  +
  +/**
   * EntityReference models the XML &entityname; syntax, when used for
   * entities defined by the DOM. Entities hardcoded into XML, such as
   * character entities, should instead have been translated into text
  @@ -139,7 +147,7 @@
       
       // EntityReference behaves as a read-only node, since its contents
       // reflect the Entity it refers to -- but see setNodeName().
  -    readOnly = false;
  +    readOnly = true;
       entityChanges=-1;
   }
   
  @@ -149,6 +157,7 @@
   : NodeImpl(other, deep)
   {
       entityChanges = other.entityChanges;
  +    readOnly = true;
   }
   
   
  @@ -212,9 +221,9 @@
   int EntityReferenceImpl::getLength()
   {
       int length = NodeImpl::getLength();
  -
  +    
   #if (0)                 // Till we add entity nodes to the doc root element.
  -
  +    
       DocumentTypeImpl *doctype;
       NamedNodeMapImpl *entities;
       EntityImpl *entDef;
  @@ -345,27 +354,37 @@
           // Note that we have to use the superclass to avoid recursion
           // through Synchronize.
           readOnly=false;
  -        if(null==entDef || !entDef->hasChildNodes())
  -            for(NodeImpl *kid=NodeImpl::getFirstChild();
  -            kid!=null;
  -            kid=NodeImpl::getFirstChild())
  +        if(null==entDef || !entDef->hasChildNodes() || entDef->changes!=entityChanges)
  +        {
  +            NodeImpl *kid;
  +            while ((kid=NodeImpl::getFirstChild()) != null)
  +            {
                   removeChild(kid);
  -            
  -            // If entity's definition changed, clone its kids
  -            // (See discussion above.)
  -            if(null!=entDef && entDef->changes!=entityChanges)
  +                // Adding and removing a reference will cause the node to
  +                // be deleted if the reference count is zero, meaning
  +                // that there are no outside (from the application code) refs
  +                // to the node.  When NodeImpl::removeChild is called from
  +                //  DOM_Node::removeChild, this reference count wiggle happens
  +                //  as a result of returning the removed node, but that doesn't
  +                //  work here, so we do it by hand.
  +                addRef(kid);
  +                removeRef(kid);
  +            }
  +        }
  +        
  +        // If entity's definition changed, clone its kids
  +        // (See discussion above.)
  +        if(null!=entDef && entDef->changes!=entityChanges)
  +        {
  +            for(NodeImpl *defkid=entDef->getFirstChild();
  +            defkid!=null; defkid=defkid->getNextSibling())
               {
  -                for(NodeImpl *defkid=entDef->getFirstChild();
  -                defkid!=null;
  -                defkid=defkid->getNextSibling())
  -                {
  -                    NodeImpl *newkid=(NodeImpl *) defkid->cloneNode(true);
  -                    newkid->setReadOnly(true,true);
  -                    insertBefore(newkid,null);
  -                    readOnly=true;
  -                }
  -                entityChanges=entDef->changes;
  +                NodeImpl *newkid=(NodeImpl *) defkid->cloneNode(true);
  +                insertBefore(newkid,null);
  +                newkid->setReadOnly(true,true);
               }
  -            readOnly=true;
  +            entityChanges=entDef->changes;
  +        }
  +        readOnly=true;
       }
   }
  
  
  
  1.5       +31 -8     xml-xerces/c/src/dom/NamedNodeMapImpl.cpp
  
  Index: NamedNodeMapImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/NamedNodeMapImpl.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NamedNodeMapImpl.cpp	2000/01/06 19:43:25	1.4
  +++ NamedNodeMapImpl.cpp	2000/01/08 00:09:28	1.5
  @@ -56,6 +56,14 @@
   
   /**
    * $Log: NamedNodeMapImpl.cpp,v $
  + * Revision 1.5  2000/01/08 00:09:28  andyh
  + * Correcf failures in DOMTest with entity references and read-only nodes.
  + * Correct reference counting problem NamedNodeMap.
  + * Add export methods to NamedNodeMap and DocumentTypeImpl.
  + * Redo DocumentImpl::cloneNode
  + *
  + * (Changes by Chih-Hsiang Chou)
  + *
    * Revision 1.4  2000/01/06 19:43:25  aruna1
    * Modifed ?: consturct on solaris to assign DOMString objects
    *
  @@ -79,6 +87,7 @@
   #include "NodeVector.hpp"
   #include "AttrImpl.hpp"
   #include "DOM_DOMException.hpp"
  +#include "DocumentImpl.hpp"
   
   
   int        NamedNodeMapImpl::gLiveNamedNodeMaps  = 0;
  @@ -88,6 +97,7 @@
   {
       this->ownerDoc=ownerD;
       this->defaults=defs;
  +    addRef(defaults);
       this->nodes = null;
       this->changes = 0;
       lastDefaultsChanges = -1;
  @@ -110,6 +120,7 @@
           nodes = 0;
       }
       gLiveNamedNodeMaps--;
  +    removeRef(defaults);
   };
   
   
  @@ -135,8 +146,7 @@
           }
       }
       newmap->defaults = defaults;
  -    if (defaults)
  -        defaults->refCount++;
  +    NamedNodeMapImpl::addRef(defaults);
       
       return newmap;
   };
  @@ -337,11 +347,9 @@
   	    if (n->isAttrImpl() && d->isAttrImpl()) {	//DOM Level 2
   		d = d->cloneNode(true); //copy d and ownerElement of n
   		((AttrImpl *) d)->setOwnerElement(((AttrImpl *) n)->getOwnerElement());
  -
  -		d->namespaceURI = (n->namespaceURI == null) ? DOMString(null) : n->namespaceURI.clone();
  -		d->prefix = (n->prefix == null) ? DOMString(null) : n->prefix.clone();
  -		d->localName = (n->localName == null) ? DOMString(null) : n->localName.clone();
  -
  +		d->namespaceURI = n->namespaceURI == null ? DOMString(null) : n->namespaceURI.clone();
  +		d->prefix = n->prefix == null ? DOMString(null) : n->prefix.clone();
  +		d->localName = n->localName == null ? DOMString(null) : n->localName.clone();
   	    }
               nodes->setElementAt(d, i);
   	} else
  @@ -475,6 +483,26 @@
   
   //Introduced in DOM Level 2
   
  +/** Export this object to a different document docImpl.
  + */
  +NamedNodeMapImpl *NamedNodeMapImpl::export(DocumentImpl *docImpl)
  +{
  +    bool deep = true;
  +    NamedNodeMapImpl *newdefs = defaults == null ? null : defaults->export(docImpl);
  +    NamedNodeMapImpl *newmap = new NamedNodeMapImpl(docImpl, newdefs);
  +    if (nodes != null)
  +    {
  +        newmap->nodes = new NodeVector(nodes->size());
  +        for (int i = 0; i < nodes->size(); ++i)
  +        {
  +            NodeImpl *n = docImpl->importNode(nodes->elementAt(i), deep);
  +            n->owned = true;
  +            newmap->nodes->addElement(n);
  +        }
  +    }
  +    return newmap;
  +}
  +
   int NamedNodeMapImpl::findNamePoint(const DOMString &namespaceURI,
   	const DOMString &localName)
   {
  @@ -562,7 +590,7 @@
   	if (n->isAttrImpl() && d->isAttrImpl()) {
   	    d = d->cloneNode(true); //copy d and ownerElement of n
   	    ((AttrImpl *) d)->setOwnerElement(((AttrImpl *) n)->getOwnerElement());
  -	    d->namespaceURI = (n->namespaceURI == null) ? DOMString(null) : n->namespaceURI.clone();
  +	    d->namespaceURI = n->namespaceURI == null ? DOMString(null) : n->namespaceURI.clone();
   	    d->prefix = n->prefix == null ? DOMString(null) : n->prefix.clone();
   	    d->localName = n->localName == null ? DOMString(null) : n->localName.clone();
   	}
  
  
  
  1.3       +4 -0      xml-xerces/c/src/dom/NamedNodeMapImpl.hpp
  
  Index: NamedNodeMapImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/NamedNodeMapImpl.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NamedNodeMapImpl.hpp	2000/01/05 01:16:08	1.2
  +++ NamedNodeMapImpl.hpp	2000/01/08 00:09:28	1.3
  @@ -59,6 +59,14 @@
   
   /**
    * $Log: NamedNodeMapImpl.hpp,v $
  + * Revision 1.3  2000/01/08 00:09:28  andyh
  + * Correcf failures in DOMTest with entity references and read-only nodes.
  + * Correct reference counting problem NamedNodeMap.
  + * Add export methods to NamedNodeMap and DocumentTypeImpl.
  + * Redo DocumentImpl::cloneNode
  + *
  + * (Changes by Chih-Hsiang Chou)
  + *
    * Revision 1.2  2000/01/05 01:16:08  andyh
    * DOM Level 2 core, namespace support added.
    *
  @@ -122,6 +130,7 @@
       virtual void            setReadOnly(bool readOnly, bool deep);
   
       //Introduced in DOM Level 2
  +    virtual NamedNodeMapImpl *export(DocumentImpl *docImpl);
       virtual int             findNamePoint(const DOMString &namespaceURI,
   	const DOMString &localName);
       virtual NodeImpl        *getNamedItemNS(const DOMString &namespaceURI,
  
  
  
  1.6       +4 -1      xml-xerces/c/src/dom/NodeImpl.cpp
  
  Index: NodeImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/NodeImpl.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- NodeImpl.cpp	2000/01/06 19:43:25	1.5
  +++ NodeImpl.cpp	2000/01/08 00:09:28	1.6
  @@ -56,6 +56,14 @@
   
   /**
   * $Log: NodeImpl.cpp,v $
  +* Revision 1.6  2000/01/08 00:09:28  andyh
  +* Correcf failures in DOMTest with entity references and read-only nodes.
  +* Correct reference counting problem NamedNodeMap.
  +* Add export methods to NamedNodeMap and DocumentTypeImpl.
  +* Redo DocumentImpl::cloneNode
  +*
  +* (Changes by Chih-Hsiang Chou)
  +*
   * Revision 1.5  2000/01/06 19:43:25  aruna1
   * Modifed ?: consturct on solaris to assign DOMString objects
   *
  @@ -378,7 +386,7 @@
   
   
   NodeImpl *NodeImpl::insertBefore(NodeImpl *newChild, NodeImpl *refChild) {
  -    if (readOnly || newChild -> readOnly)
  +    if (readOnly)
           throw DOM_DOMException(
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);