[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-cvs
Subject:    cvs commit: xml-xerces/c/Projects/Win32/VC6/xerces-all/XercesLib XercesLib.dsp
From:       lehors () locus ! apache ! org
Date:       2000-04-27 2:52:50
[Download RAW message or body]

lehors      00/04/26 19:52:50

  Modified:    c/src/dom AttrImpl.cpp AttrImpl.hpp AttrNSImpl.cpp
                        CharacterDataImpl.cpp CharacterDataImpl.hpp
                        DOM_DOMImplementation.cpp DeepNodeListImpl.cpp
                        DocumentFragmentImpl.cpp DocumentFragmentImpl.hpp
                        DocumentImpl.cpp DocumentImpl.hpp
                        DocumentTypeImpl.cpp DocumentTypeImpl.hpp
                        ElementImpl.cpp ElementImpl.hpp ElementNSImpl.cpp
                        EntityImpl.cpp EntityImpl.hpp
                        EntityReferenceImpl.cpp EntityReferenceImpl.hpp
                        NamedNodeMapImpl.cpp NamedNodeMapImpl.hpp
                        NodeImpl.cpp NodeImpl.hpp NotationImpl.cpp
                        ProcessingInstructionImpl.cpp
                        ProcessingInstructionImpl.hpp TextImpl.cpp
                        TextImpl.hpp XMLDeclImpl.cpp XMLDeclImpl.hpp
               c/src/parsers DOMParser.cpp
               c/Projects/Win32/VC6/xerces-all/XercesLib XercesLib.dsp
  Added:       c/src/dom ChildAndParentNode.cpp ChildAndParentNode.hpp
                        ChildNode.cpp ChildNode.hpp ParentNode.cpp
                        ParentNode.hpp
  Removed:     c/src/dom NodeContainer.cpp NodeContainer.hpp
  Log:
  global reorganization similar to what I've done in Java,
  nodes now are much smaller.
  The main changes are:
  renamed NodeContainer to ParentNode,
  introduced ChildNode and ChildAndParentNode,
  all the boolean attributes have been changed to bit flags,
  ownerDocument is no longer an attribute of NodeImpl, only Parent nodes have
  it, leave nodes rely on their parent to get it, or get it from ownerNode when
  they do not have a parent,
  parent Nodes no longer have a direct pointer to the last child
  instead the last child is stored as the previous sibling of
  the first child.
  I also added support for importing a DocumentType as it's done in Java,
  and got the importNode mechanism back in sync with Java as well.
  
  Here are the most significant changes in size:
  ElementImpl 52 -> 48
  TextImpl    44 -> 32
  AttrImpl    52 -> 36
  
  Revision  Changes    Path
  1.15      +18 -25    xml-xerces/c/src/dom/AttrImpl.cpp
  
  Index: AttrImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/AttrImpl.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AttrImpl.cpp	2000/04/07 00:51:44	1.14
  +++ AttrImpl.cpp	2000/04/27 02:52:42	1.15
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: AttrImpl.cpp,v 1.14 2000/04/07 00:51:44 lehors Exp $
  + * $Id: AttrImpl.cpp,v 1.15 2000/04/27 02:52:42 lehors Exp $
    */
   
   #include "AttrImpl.hpp"
  @@ -66,20 +66,18 @@
   #include "DStringPool.hpp"
   
   
  -#define null 0
  -
   AttrImpl::AttrImpl(DocumentImpl *ownerDoc, const DOMString &aName) 
  -    : NodeContainer (ownerDoc)
  +    : ParentNode (ownerDoc)
   {
       name = aName.clone();
  -    specified = true;
  +    specified(true);
   };
   
   AttrImpl::AttrImpl(const AttrImpl &other, bool deep)
  -    : NodeContainer(other)
  +    : ParentNode(other)
   {
       name = other.name.clone();
  -    specified = false;
  +    specified(false);
       if (deep)
         cloneChildren(other);
   };
  @@ -117,17 +115,9 @@
   };
   
   
  -// ownerNode is used to store the ownerElement,
  -// Attr nodes do not have a parent
  -NodeImpl * AttrImpl::getParentNode()
  -{
  -    return 0;
  -};
  -
  -
   bool AttrImpl::getSpecified() 
   {
  -    return specified;
  +    return specified();
   };
   
   
  @@ -136,13 +126,13 @@
   DOMString AttrImpl::getValue() 
   {
       int             length = 0;
  -    NodeImpl        *node;
  -    for (node = getFirstChild(); node != null; node = node->getNextSibling())
  +    ChildNode        *node;
  +    for (node = firstChild; node != null; node = node->nextSibling)
           length += node->getNodeValue().length();
       
       DOMString retString;
  -	retString.reserve(length);
  -    for (node = getFirstChild(); node != null; node = node->getNextSibling())
  +    retString.reserve(length);
  +    for (node = firstChild; node != null; node = node->nextSibling)
       {
           retString.appendData(node->getNodeValue());
       };
  @@ -166,14 +156,14 @@
   
   void AttrImpl::setSpecified(bool arg)
   {
  -    specified = arg;
  +    specified(arg);
   };
   
   
   
   void AttrImpl::setValue(const DOMString &val)
   {
  -    if (readOnly)
  +    if (readOnly())
       {
           throw DOM_DOMException
           (
  @@ -182,7 +172,7 @@
       }
       
       NodeImpl *kid;
  -    while ((kid = getFirstChild()) != null)         // Remove existing kids
  +    while ((kid = firstChild) != null)         // Remove existing kids
       {
           removeChild(kid);
           if (kid->nodeRefCount == 0)
  @@ -191,7 +181,7 @@
   
       if (val != null)              // Create and add the new one
           appendChild(ownerDocument->createTextNode(val));
  -    specified = true;
  +    specified(true);
       changed();
   };
   
  @@ -213,7 +203,9 @@
   
   ElementImpl *AttrImpl::getOwnerElement()
   {
  -    return (ElementImpl*) ownerNode;
  +    // if we have an owner, ownerNode is our ownerElement, otherwise it's
  +    // our ownerDocument and we don't have an ownerElement
  +    return (ElementImpl *) (owned() ? ownerNode : null);
   }
   
   
  @@ -221,4 +213,5 @@
   void AttrImpl::setOwnerElement(ElementImpl *ownerElem)
   {
       ownerNode = ownerElem;
  +    owned(false);
   }
  
  
  
  1.11      +3 -5      xml-xerces/c/src/dom/AttrImpl.hpp
  
  Index: AttrImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/AttrImpl.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AttrImpl.hpp	2000/04/06 23:59:22	1.10
  +++ AttrImpl.hpp	2000/04/27 02:52:42	1.11
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: AttrImpl.hpp,v 1.10 2000/04/06 23:59:22 lehors Exp $
  + * $Id: AttrImpl.hpp,v 1.11 2000/04/27 02:52:42 lehors Exp $
    */
   
   //
  @@ -73,16 +73,15 @@
   
   
   #include <util/XercesDefs.hpp>
  -#include "NodeContainer.hpp"
  +#include "ParentNode.hpp"
   #include "DOM_Node.hpp"
   
   class ElementImpl;
   
  -class CDOM_EXPORT AttrImpl: public NodeContainer {
  +class CDOM_EXPORT AttrImpl: public ParentNode {
       
   public:
       DOMString name;
  -    bool specified;
   
   public:
       AttrImpl(DocumentImpl *ownerDocument, const DOMString &aName);
  @@ -93,7 +92,6 @@
       virtual short getNodeType();
       virtual DOMString getName();
       virtual DOMString getNodeValue();
  -    virtual NodeImpl * getParentNode();
       virtual bool getSpecified();
       virtual DOMString getValue();
       virtual bool isAttrImpl();
  
  
  
  1.3       +2 -5      xml-xerces/c/src/dom/AttrNSImpl.cpp
  
  Index: AttrNSImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/AttrNSImpl.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AttrNSImpl.cpp	2000/04/06 19:23:57	1.2
  +++ AttrNSImpl.cpp	2000/04/27 02:52:42	1.3
  @@ -55,15 +55,13 @@
    */
   
   /*
  - * $Id: AttrNSImpl.cpp,v 1.2 2000/04/06 19:23:57 lehors Exp $
  + * $Id: AttrNSImpl.cpp,v 1.3 2000/04/27 02:52:42 lehors Exp $
    */
   
   #include "AttrNSImpl.hpp"
   #include "DocumentImpl.hpp"
   #include "DOM_DOMException.hpp"
   
  -#define null 0
  -
   AttrNSImpl::AttrNSImpl(DocumentImpl *ownerDoc, const DOMString &nam) :
       AttrImpl(ownerDoc, name)
   {
  @@ -80,7 +78,6 @@
   {
       DOMString xmlns = NodeImpl::getXmlnsString();
       DOMString xmlnsURI = NodeImpl::getXmlnsURIString();
  -    this->ownerDocument=ownerDoc;
       this->name = qualifiedName.clone();
   
       int index = DocumentImpl::indexofQualifiedName(qualifiedName);
  @@ -141,7 +138,7 @@
       DOMString xmlns = NodeImpl::getXmlnsString();
       DOMString xmlnsURI = NodeImpl::getXmlnsURIString();
   
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR,
                                  null);
       if (namespaceURI == null || localName.equals(xmlns))
  
  
  
  1.12      +9 -9      xml-xerces/c/src/dom/CharacterDataImpl.cpp
  
  Index: CharacterDataImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/CharacterDataImpl.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- CharacterDataImpl.cpp	2000/04/07 00:51:44	1.11
  +++ CharacterDataImpl.cpp	2000/04/27 02:52:42	1.12
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: CharacterDataImpl.cpp,v 1.11 2000/04/07 00:51:44 lehors Exp $
  + * $Id: CharacterDataImpl.cpp,v 1.12 2000/04/27 02:52:42 lehors Exp $
    */
   
   #include "CharacterDataImpl.hpp"
  @@ -64,13 +64,13 @@
   
   CharacterDataImpl::CharacterDataImpl(DocumentImpl *ownerDoc,
                                        const DOMString &data)
  -    : NodeImpl(ownerDoc)
  +    : ChildNode(ownerDoc)
   {
       this->data = data.clone();
   };
   
   CharacterDataImpl::CharacterDataImpl(const CharacterDataImpl &other, bool deep)
  -    : NodeImpl(other)
  +    : ChildNode(other)
   {
       data = other.data.clone();
   };
  @@ -88,7 +88,7 @@
   
   void CharacterDataImpl::setNodeValue(const DOMString &value)
   {
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR,
                                  null);
       data = value.clone();
  @@ -97,7 +97,7 @@
   
   void CharacterDataImpl::appendData(const DOMString &data)
   {
  -    if(readOnly)
  +    if(readOnly())
           throw DOM_DOMException(
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
       
  @@ -107,7 +107,7 @@
   
   void CharacterDataImpl::deleteData(unsigned int offset, unsigned int count)
   {
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
   
  @@ -145,7 +145,7 @@
   void CharacterDataImpl::insertData(unsigned int offset, const DOMString &data) 
   {
       
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
       
  @@ -160,7 +160,7 @@
   void CharacterDataImpl::replaceData(unsigned int offset, unsigned int count,
                                       const DOMString &data)
   {
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
       deleteData(offset, count);
  @@ -172,7 +172,7 @@
   
   void CharacterDataImpl::setData(const DOMString &arg)
   {
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR,
                                  null);
       data = arg.clone();
  
  
  
  1.10      +3 -4      xml-xerces/c/src/dom/CharacterDataImpl.hpp
  
  Index: CharacterDataImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/CharacterDataImpl.hpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- CharacterDataImpl.hpp	2000/04/07 00:51:45	1.9
  +++ CharacterDataImpl.hpp	2000/04/27 02:52:42	1.10
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: CharacterDataImpl.hpp,v 1.9 2000/04/07 00:51:45 lehors Exp $
  + * $Id: CharacterDataImpl.hpp,v 1.10 2000/04/27 02:52:42 lehors Exp $
    */
   
   //
  @@ -72,10 +72,9 @@
   
   
   
  -#include "NodeImpl.hpp"
  -#include "DOMString.hpp"
  +#include "ChildNode.hpp"
   
  -class CDOM_EXPORT CharacterDataImpl: public NodeImpl
  +class CDOM_EXPORT CharacterDataImpl: public ChildNode
   {
   protected:
       DOMString data;
  
  
  
  1.8       +6 -1      xml-xerces/c/src/dom/DOM_DOMImplementation.cpp
  
  Index: DOM_DOMImplementation.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/DOM_DOMImplementation.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOM_DOMImplementation.cpp	2000/03/02 19:53:54	1.7
  +++ DOM_DOMImplementation.cpp	2000/04/27 02:52:42	1.8
  @@ -56,6 +56,27 @@
   
   /*
    * $Log: DOM_DOMImplementation.cpp,v $
  + * Revision 1.8  2000/04/27 02:52:42  lehors
  + * global reorganization similar to what I've done in Java,
  + * nodes now are much smaller.
  + * The main changes are:
  + * renamed NodeContainer to ParentNode,
  + * introduced ChildNode and ChildAndParentNode,
  + * all the boolean attributes have been changed to bit flags,
  + * ownerDocument is no longer an attribute of NodeImpl, only Parent nodes have
  + * it, leave nodes rely on their parent to get it, or get it from ownerNode when
  + * they do not have a parent,
  + * parent Nodes no longer have a direct pointer to the last child
  + * instead the last child is stored as the previous sibling of
  + * the first child.
  + * I also added support for importing a DocumentType as it's done in Java,
  + * and got the importNode mechanism back in sync with Java as well.
  + *
  + * Here are the most significant changes in size:
  + * ElementImpl 52 -> 48
  + * TextImpl    44 -> 32
  + * AttrImpl    52 -> 36
  + *
    * Revision 1.7  2000/03/02 19:53:54  roddey
    * This checkin includes many changes done while waiting for the
    * 1.1.0 code to be finished. I can't list them all here, but a list is
  @@ -184,7 +205,7 @@
   {
       if(!DocumentImpl::isXMLName(qualifiedName))
           throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null);
  -    return DOM_DocumentType(new DocumentTypeImpl(qualifiedName, publicId, \
systemId));  +    return DOM_DocumentType(new DocumentTypeImpl(null, qualifiedName, \
publicId, systemId));  }
   
   DOM_Document DOM_DOMImplementation::createDocument(const DOMString &namespaceURI,
  
  
  
  1.6       +7 -2      xml-xerces/c/src/dom/DeepNodeListImpl.cpp
  
  Index: DeepNodeListImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/DeepNodeListImpl.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DeepNodeListImpl.cpp	2000/03/02 19:53:59	1.5
  +++ DeepNodeListImpl.cpp	2000/04/27 02:52:42	1.6
  @@ -56,6 +56,27 @@
   
   /*
    * $Log: DeepNodeListImpl.cpp,v $
  + * Revision 1.6  2000/04/27 02:52:42  lehors
  + * global reorganization similar to what I've done in Java,
  + * nodes now are much smaller.
  + * The main changes are:
  + * renamed NodeContainer to ParentNode,
  + * introduced ChildNode and ChildAndParentNode,
  + * all the boolean attributes have been changed to bit flags,
  + * ownerDocument is no longer an attribute of NodeImpl, only Parent nodes have
  + * it, leave nodes rely on their parent to get it, or get it from ownerNode when
  + * they do not have a parent,
  + * parent Nodes no longer have a direct pointer to the last child
  + * instead the last child is stored as the previous sibling of
  + * the first child.
  + * I also added support for importing a DocumentType as it's done in Java,
  + * and got the importNode mechanism back in sync with Java as well.
  + *
  + * Here are the most significant changes in size:
  + * ElementImpl 52 -> 48
  + * TextImpl    44 -> 32
  + * AttrImpl    52 -> 36
  + *
    * Revision 1.5  2000/03/02 19:53:59  roddey
    * This checkin includes many changes done while waiting for the
    * 1.1.0 code to be finished. I can't list them all here, but a list is
  @@ -144,10 +165,10 @@
   {
       NodeImpl *thisNode;
       
  -    if(rootNode->changes != changes)
  +    if(rootNode->changes() != changes)
       {
           nodes->reset();     // Tree changed. Do it all from scratch!
  -        changes=rootNode->changes;
  +        changes = rootNode->changes();
       }
       
       if(index< nodes->size())      // In the cache
  
  
  
  1.10      +3 -3      xml-xerces/c/src/dom/DocumentFragmentImpl.cpp
  
  Index: DocumentFragmentImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/DocumentFragmentImpl.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DocumentFragmentImpl.cpp	2000/04/07 00:51:45	1.9
  +++ DocumentFragmentImpl.cpp	2000/04/27 02:52:43	1.10
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: DocumentFragmentImpl.cpp,v 1.9 2000/04/07 00:51:45 lehors Exp $
  + * $Id: DocumentFragmentImpl.cpp,v 1.10 2000/04/27 02:52:43 lehors Exp $
    */
   
   #include "DocumentFragmentImpl.hpp"
  @@ -67,14 +67,14 @@
   static DOMString *nam;   // Will be lazily initialized to "#document-fragment"
   
   DocumentFragmentImpl::DocumentFragmentImpl(DocumentImpl *masterDoc)
  -    : NodeContainer(masterDoc)
  +    : ParentNode(masterDoc)
   {
   };
           
   
   DocumentFragmentImpl::DocumentFragmentImpl(const DocumentFragmentImpl &other,
                                              bool deep)
  -    : NodeContainer(other)
  +    : ParentNode(other)
   {
       if (deep)
           cloneChildren(other);
  
  
  
  1.9       +3 -3      xml-xerces/c/src/dom/DocumentFragmentImpl.hpp
  
  Index: DocumentFragmentImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/DocumentFragmentImpl.hpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DocumentFragmentImpl.hpp	2000/04/06 23:59:22	1.8
  +++ DocumentFragmentImpl.hpp	2000/04/27 02:52:43	1.9
  @@ -57,7 +57,7 @@
    */
   
   /*
  - * $Id: DocumentFragmentImpl.hpp,v 1.8 2000/04/06 23:59:22 lehors Exp $
  + * $Id: DocumentFragmentImpl.hpp,v 1.9 2000/04/27 02:52:43 lehors Exp $
    */
   
   //
  @@ -70,9 +70,9 @@
   //
   
   #include <util/XercesDefs.hpp>
  -#include "NodeContainer.hpp"
  +#include "ParentNode.hpp"
   
  -class CDOM_EXPORT DocumentFragmentImpl: public NodeContainer {
  +class CDOM_EXPORT DocumentFragmentImpl: public ParentNode {
   protected:
       DocumentFragmentImpl(DocumentImpl *);
   
  
  
  
  1.22      +141 -39   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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DocumentImpl.cpp	2000/04/25 20:29:32	1.21
  +++ DocumentImpl.cpp	2000/04/27 02:52:43	1.22
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: DocumentImpl.cpp,v 1.21 2000/04/25 20:29:32 aruna1 Exp $
  + * $Id: DocumentImpl.cpp,v 1.22 2000/04/27 02:52:43 lehors Exp $
    */
   
   //
  @@ -113,7 +113,7 @@
   
   
   DocumentImpl::DocumentImpl()
  -    : NodeContainer(null)
  +    : ParentNode(this)
   {
       docType=null;
       docElement=null;
  @@ -128,7 +128,7 @@
   DocumentImpl::DocumentImpl(const DOMString &fNamespaceURI,
                              const DOMString &qualifiedName,
                              DocumentTypeImpl *doctype)
  -    : NodeContainer(null)
  +    : ParentNode(this)
   {
       docType=null;
       
  @@ -151,10 +151,10 @@
           throw DOM_DOMException(	//one doctype can belong to only one DocumentImpl
           DOM_DOMException::WRONG_DOCUMENT_ERR, null);
       
  -    doctype -> setOwnerDocument(this);
  -	doctype->getEntities()->ownerNode->ownerDocument = this;
  -	doctype->getNotations()->ownerNode->ownerDocument = this;
  -	doctype -> referenced();         // Warning, tricky!  An external (DOM_Node) \
reference  +    doctype->setOwnerDocument(this);
  +    doctype->getEntities()->ownerNode->setOwnerDocument(this);
  +    doctype->getNotations()->ownerNode->setOwnerDocument(this);
  +    doctype -> referenced();         // Warning, tricky!  An external (DOM_Node) \
                reference
                                        //  to a node normally bumps the reference \
                count to its
                                        //  document also.  But this could not happen \
                when the
                                        //  user created the DOM_DocumentType because \
there was  @@ -190,19 +190,14 @@
   
   
   NodeImpl *DocumentImpl::cloneNode(bool deep) {
  +
  +    // clone the node itself
       DocumentImpl *newdoc = new DocumentImpl();
  +
  +    // then the children by _importing_ them
       if (deep)
  -        for (NodeImpl *n=getFirstChild(); n!=null; n=n->getNextSibling()) {
  -	    if (n -> isDocumentTypeImpl()) {
  -		DocumentTypeImpl *doctype = ((DocumentTypeImpl *)n) -> exportNode(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));
  +        for (ChildNode *n = firstChild; n != null; n = n->nextSibling) {
  +            newdoc->appendChild(newdoc->importNode(n, true));
   	}
       return newdoc;
   };
  @@ -219,6 +214,13 @@
   };
   
   
  +// even though ownerDocument refers to this in this implementation
  +// the DOM Level 2 spec says it must be null, so make it appear so
  +DocumentImpl * DocumentImpl::getOwnerDocument() {
  +    return null;
  +}
  +
  +
   bool DocumentImpl::isDocumentImpl() {
       return true;
   };
  @@ -264,6 +266,20 @@
   
   
   
  +DocumentTypeImpl *
  +    DocumentImpl::createDocumentType(const DOMString &qualifiedName,
  +                                     const DOMString &publicId,
  +                                     const DOMString &systemId)
  +{
  +    if (!isXMLName(qualifiedName))
  +        throw DOM_DOMException(
  +        DOM_DOMException::INVALID_CHARACTER_ERR, null);
  +
  +    return new DocumentTypeImpl(this, qualifiedName, publicId, systemId);
  +};
  +
  +
  +
   ElementImpl *DocumentImpl::createElement(const DOMString &tagName)
   {
       if(!isXMLName(tagName))
  @@ -414,7 +430,7 @@
           )
           throw DOM_DOMException(DOM_DOMException::HIERARCHY_REQUEST_ERR,null);
   
  -    NodeContainer::insertBefore(newChild,refChild);
  +    ParentNode::insertBefore(newChild,refChild);
   
       // If insert succeeded, cache the kid appropriately
       if(newChild->isElementImpl())
  @@ -463,7 +479,7 @@
   
   NodeImpl *DocumentImpl::removeChild(NodeImpl *oldChild)
   {
  -    NodeContainer::removeChild(oldChild);
  +    ParentNode::removeChild(oldChild);
   
       // If remove succeeded, un-cache the kid appropriately
       if(oldChild->isElementImpl())
  @@ -513,17 +529,20 @@
   	    if (source->getLocalName() == null)
   		newelement = createElement(source->getNodeName());
   	    else
  -		newelement = createElementNS(source->getNamespaceURI(), source->getNodeName());
  +		newelement = createElementNS(source->getNamespaceURI(),
  +                                             source->getNodeName());
               NamedNodeMapImpl *srcattr=source->getAttributes();
               if(srcattr!=null)
                   for(unsigned int i=0;i<srcattr->getLength();++i)
   		{
   		    AttrImpl *attr = (AttrImpl *) srcattr->item(i);
  -		    if (attr -> getSpecified())	//not a default attribute
  +		    if (attr -> getSpecified())	{ // not a default attribute
  +                        AttrImpl *nattr = (AttrImpl *) importNode(attr, true);
   			if (attr -> getLocalName() == null)
  -			    newelement->setAttributeNode((AttrImpl *)importNode(attr, true));
  +			    newelement->setAttributeNode(nattr);
   			else
  -			    newelement->setAttributeNodeNS((AttrImpl *)importNode(attr, true));
  +			    newelement->setAttributeNodeNS(nattr);
  +                    }
   		}
               newnode=newelement;
           }
  @@ -532,7 +551,8 @@
   	if (source->getLocalName() == null)
   	    newnode = createAttribute(source->getNodeName());
   	else
  -	    newnode = createAttributeNS(source->getNamespaceURI(), \
source->getNodeName());  +	    newnode = createAttributeNS(source->getNamespaceURI(),
  +                                        source->getNodeName());
   	deep = true;
           // Kids carry value
           break;
  @@ -542,15 +562,9 @@
       case DOM_Node::CDATA_SECTION_NODE :
           newnode = createCDATASection(source->getNodeValue());
           break;
  -    case DOM_Node::COMMENT_NODE :
  -        newnode = createComment(source->getNodeValue());
  -        break;
       case DOM_Node::ENTITY_REFERENCE_NODE :
           newnode = createEntityReference(source->getNodeName());
  -	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.
  +	newnode -> readOnly(false); //allow deep import temporarily
           break;
       case DOM_Node::ENTITY_NODE :
           {
  @@ -561,10 +575,45 @@
               newentity->setNotationName(srcentity->getNotationName());
               // Kids carry additional value
               newnode=newentity;
  +            newentity->readOnly(false);// allow deep import temporarily
           }
           break;
       case DOM_Node::PROCESSING_INSTRUCTION_NODE :
  -        newnode = createProcessingInstruction(source->getNodeName(), \
source->getNodeValue());  +        newnode = \
createProcessingInstruction(source->getNodeName(),  +                                 \
source->getNodeValue());  +        break;
  +    case DOM_Node::COMMENT_NODE :
  +        newnode = createComment(source->getNodeValue());
  +        break;
  +    case DOM_Node::DOCUMENT_TYPE_NODE :
  +        {
  +            DocumentTypeImpl *srcdoctype = (DocumentTypeImpl *)source;
  +            DocumentTypeImpl *newdoctype = (DocumentTypeImpl *)
  +                createDocumentType(srcdoctype->getNodeName(),
  +                                   srcdoctype->getPublicId(),
  +                                   srcdoctype->getSystemId());
  +            // Values are on NamedNodeMaps
  +            NamedNodeMapImpl *smap = srcdoctype->getEntities();
  +            NamedNodeMapImpl *tmap = newdoctype->getEntities();
  +            if(smap != null) {
  +                for(unsigned int i = 0; i < smap->getLength(); i++) {
  +                    tmap->setNamedItem(importNode(smap->item(i), true));
  +                }
  +            }
  +            smap = srcdoctype->getNotations();
  +            tmap = newdoctype->getNotations();
  +            if (smap != null) {
  +                for(unsigned int i = 0; i < smap->getLength(); i++) {
  +                    tmap->setNamedItem(importNode(smap->item(i), true));
  +                }
  +            }
  +            // 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
  +            // copying from domimpl to domimpl. We could special-case
  +            // that here. Arguably we should. Consider. ?????
  +            newnode = newdoctype;
  +        }
           break;
       case DOM_Node::DOCUMENT_FRAGMENT_NODE :
           newnode = createDocumentFragment();
  @@ -583,19 +632,20 @@
           }
   
       case DOM_Node::DOCUMENT_NODE : // Document can't be child of Document
  -    case DOM_Node::DOCUMENT_TYPE_NODE :
       default:                       // Unknown node type
           throw DOM_DOMException(DOM_DOMException::NOT_SUPPORTED_ERR, null);
       }
   
       // If deep, replicate and attach the kids.
       if (deep)
  -        for (NodeImpl *srckid = source->getFirstChild(); srckid != null; srckid = \
                srckid->getNextSibling())
  -        {
  +        for (NodeImpl *srckid = source->getFirstChild();
  +             srckid != null;
  +             srckid = srckid->getNextSibling()) {
               newnode->appendChild(importNode(srckid, true));
           }
  -    if (newnode -> getNodeType() == DOM_Node::ENTITY_REFERENCE_NODE)
  -	newnode -> readOnly = true;
  +    if (newnode->getNodeType() == DOM_Node::ENTITY_REFERENCE_NODE
  +        || newnode->getNodeType() == DOM_Node::ENTITY_REFERENCE_NODE)
  +	newnode->readOnly(true);
   
       return newnode;
   };
  @@ -667,4 +717,56 @@
   XMLDeclImpl* DocumentImpl::createXMLDecl(const DOMString& version, const \
DOMString& encoding, const DOMString& standalone)  {
       return new XMLDeclImpl(this, version, encoding, standalone);
  -}
  \ No newline at end of file
  +}
  +
  +
  +/** Uses the kidOK lookup table to check whether the proposed
  +    tree structure is legal.
  +
  +    ????? It feels like there must be a more efficient solution,
  +    but for the life of me I can't think what it would be.
  +*/
  +bool DocumentImpl::isKidOK(NodeImpl *parent, NodeImpl *child)
  +{
  +      static int kidOK[14];
  +      
  +      if (kidOK[DOM_Node::DOCUMENT_NODE] == 0)
  +      {
  +          kidOK[DOM_Node::DOCUMENT_NODE] = 
  +              1 << DOM_Node::ELEMENT_NODE |
  +              1 << DOM_Node::PROCESSING_INSTRUCTION_NODE | 
  +              1 << DOM_Node::COMMENT_NODE | 
  +              1 << DOM_Node::DOCUMENT_TYPE_NODE |
  +              1 << DOM_Node::XML_DECL_NODE;
  +          
  +          kidOK[DOM_Node::DOCUMENT_FRAGMENT_NODE] = 
  +              kidOK[DOM_Node::ENTITY_NODE] = 
  +              kidOK[DOM_Node::ENTITY_REFERENCE_NODE] = 
  +              kidOK[DOM_Node::ELEMENT_NODE] = 
  +              1 << DOM_Node::ELEMENT_NODE |
  +              1 << DOM_Node::PROCESSING_INSTRUCTION_NODE | 
  +              1 << DOM_Node::COMMENT_NODE |
  +              1 << DOM_Node::TEXT_NODE |
  +              1 << DOM_Node::CDATA_SECTION_NODE |
  +              1 << DOM_Node::ENTITY_REFERENCE_NODE |
  +              1 << DOM_Node::XML_DECL_NODE;
  +          
  +          kidOK[DOM_Node::DOCUMENT_TYPE_NODE] = 
  +              1 << DOM_Node::NOTATION_NODE |
  +              1 << DOM_Node::ENTITY_NODE;
  +          
  +          kidOK[DOM_Node::ATTRIBUTE_NODE] = 
  +              1 << DOM_Node::TEXT_NODE |
  +              1 << DOM_Node::ENTITY_REFERENCE_NODE;
  +          
  +          kidOK[DOM_Node::PROCESSING_INSTRUCTION_NODE] = 
  +              kidOK[DOM_Node::COMMENT_NODE] = 
  +              kidOK[DOM_Node::TEXT_NODE] = 
  +              kidOK[DOM_Node::CDATA_SECTION_NODE] = 
  +              kidOK[DOM_Node::NOTATION_NODE] = 
  +              0;
  +      };
  +      int p=parent->getNodeType();
  +      int ch = child->getNodeType();
  +      return (kidOK[p] & 1<<ch) != 0;
  +};
  
  
  
  1.15      +8 -4      xml-xerces/c/src/dom/DocumentImpl.hpp
  
  Index: DocumentImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/DocumentImpl.hpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DocumentImpl.hpp	2000/04/25 20:29:32	1.14
  +++ DocumentImpl.hpp	2000/04/27 02:52:43	1.15
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: DocumentImpl.hpp,v 1.14 2000/04/25 20:29:32 aruna1 Exp $
  + * $Id: DocumentImpl.hpp,v 1.15 2000/04/27 02:52:43 lehors Exp $
    */
   
   //
  @@ -71,7 +71,7 @@
   //
   
   #include <util/XercesDefs.hpp>
  -#include "NodeContainer.hpp"
  +#include "ParentNode.hpp"
   #include "DOM_Node.hpp"
   #include "DOM_Element.hpp"
   #include "util/RefVectorOf.hpp"
  @@ -103,9 +103,8 @@
   typedef RefVectorOf<TreeWalkerImpl> TreeWalkers;
   
   
  -class CDOM_EXPORT DocumentImpl: public NodeContainer {
  +class CDOM_EXPORT DocumentImpl: public ParentNode {
   private:
  -private:
       // -----------------------------------------------------------------------
       //  Private data types
       // -----------------------------------------------------------------------
  @@ -144,11 +143,15 @@
       virtual NodeImpl            *cloneNode(bool deep);
       virtual DOMString getNodeName();
       virtual short getNodeType();
  +    virtual DocumentImpl * getOwnerDocument();
       virtual AttrImpl            *createAttribute(const DOMString &name);
       virtual CDATASectionImpl    *createCDATASection(const DOMString &data);
       virtual CommentImpl         *createComment(const DOMString &data);
       virtual DocumentFragmentImpl *createDocumentFragment();
       virtual DocumentTypeImpl    *createDocumentType(const DOMString &name);
  +    virtual DocumentTypeImpl    *createDocumentType(const DOMString &qName,
  +                                                    const DOMString &publicId,
  +                                                    const DOMString &systemId);
       virtual ElementImpl         *createElement(const DOMString & tagName);
       virtual ElementImpl         *createElement(const XMLCh *tagName);
       virtual EntityImpl          *createEntity(const DOMString & name);
  @@ -186,6 +189,7 @@
       //Return the index > 0 of ':' in the given qualified name \
                qName="prefix:localName".
       //Return 0 if there is no ':', or -1 if qName is malformed such as ":abcd".
       static  int                 indexofQualifiedName(const DOMString & qName);
  +    static  bool        isKidOK(NodeImpl *parent, NodeImpl *child);
   };
   
   #endif
  
  
  
  1.18      +20 -36    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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DocumentTypeImpl.cpp	2000/04/20 18:57:49	1.17
  +++ DocumentTypeImpl.cpp	2000/04/27 02:52:43	1.18
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: DocumentTypeImpl.cpp,v 1.17 2000/04/20 18:57:49 aruna1 Exp $
  + * $Id: DocumentTypeImpl.cpp,v 1.18 2000/04/27 02:52:43 lehors Exp $
    */
   
   #include "DocumentTypeImpl.hpp"
  @@ -67,7 +67,7 @@
   
   DocumentTypeImpl::DocumentTypeImpl(DocumentImpl *ownerDoc,
                                      const DOMString &dtName) 
  -    : NodeContainer(ownerDoc),
  +    : ChildAndParentNode(ownerDoc),
       publicId(null), systemId(null), internalSubset(null) //DOM Level 2
   	, intSubsetReading(false)	
   {
  @@ -79,10 +79,12 @@
   
   
   //Introduced in DOM Level 2
  -DocumentTypeImpl::DocumentTypeImpl(const DOMString &qualifiedName,
  -    const DOMString &fPublicId, const DOMString &fSystemId)
  -	: NodeContainer(null),
  -    publicId(fPublicId), systemId(fSystemId), internalSubset(null)
  +DocumentTypeImpl::DocumentTypeImpl(DocumentImpl *ownerDoc,
  +                                   const DOMString &qualifiedName,
  +                                   const DOMString &publicId,
  +                                   const DOMString &systemId)
  +	: ChildAndParentNode(ownerDoc),
  +    publicId(publicId), systemId(systemId), internalSubset(null)
   	, intSubsetReading(false)
   {
       name = qualifiedName.clone();
  @@ -96,7 +98,7 @@
   
   
   DocumentTypeImpl::DocumentTypeImpl(const DocumentTypeImpl &other, bool deep)
  -    : NodeContainer(other)
  +    : ChildAndParentNode(other)
   {
       name = other.name.clone();
       if (deep)
  @@ -133,6 +135,16 @@
       return new DocumentTypeImpl(*this, deep);
   };
   
  +/**
  + * NON-DOM
  + * set the ownerDocument of this node and its children
  + */
  +void DocumentTypeImpl::setOwnerDocument(DocumentImpl *doc) {
  +    ChildAndParentNode::setOwnerDocument(doc);
  +    entities->setOwnerDocument(doc);
  +    notations->setOwnerDocument(doc);
  +    //    elements->setOwnerDocument(doc);
  +}
   
   DOMString DocumentTypeImpl::getNodeName()
   {
  @@ -178,7 +190,7 @@
   
   void DocumentTypeImpl::setReadOnly(bool readOnl, bool deep)
   {
  -    NodeContainer::setReadOnly(readOnl,deep);
  +    ChildAndParentNode::setReadOnly(readOnl,deep);
       entities->setReadOnly(readOnl,true);
       notations->setReadOnly(readOnl,true);
   };
  @@ -231,31 +243,3 @@
           return;
       internalSubset = value.clone();
   }
  -
  -void DocumentTypeImpl::setOwnerDocument(DocumentImpl *docImpl)
  -{
  -    ownerDocument = docImpl;
  -    //Note: ownerDoc of entities, notations 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::exportNode(DocumentImpl *docImpl, bool deep)
  -{
  -    DocumentTypeImpl *doctype;
  -    doctype = new DocumentTypeImpl(name, publicId, systemId);
  -	doctype -> internalSubset = internalSubset;
  -	doctype -> intSubsetReading = false;
  -    doctype -> setOwnerDocument(docImpl);
  -    if (deep) {
  -		delete doctype -> entities;
  -		delete doctype -> notations;
  -		doctype -> entities = entities -> exportNode(doctype);
  -		doctype -> notations = notations -> exportNode(doctype);
  -    }
  -	
  -    return doctype;
  -}
  -
  
  
  
  1.14      +7 -8      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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DocumentTypeImpl.hpp	2000/04/20 18:57:50	1.13
  +++ DocumentTypeImpl.hpp	2000/04/27 02:52:43	1.14
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: DocumentTypeImpl.hpp,v 1.13 2000/04/20 18:57:50 aruna1 Exp $
  + * $Id: DocumentTypeImpl.hpp,v 1.14 2000/04/27 02:52:43 lehors Exp $
    */
   
   //
  @@ -73,11 +73,11 @@
   
   
   #include <util/XercesDefs.hpp>
  -#include "NodeContainer.hpp"
  +#include "ChildAndParentNode.hpp"
   
   class NamedNodeMapImpl;
   
  -class CDOM_EXPORT DocumentTypeImpl: public NodeContainer {
  +class CDOM_EXPORT DocumentTypeImpl: public ChildAndParentNode {
   private:
       DOMString			name;
       NamedNodeMapImpl	*entities;
  @@ -97,13 +97,15 @@
       
   public:
       DocumentTypeImpl(DocumentImpl *, const DOMString &);
  -    DocumentTypeImpl(const DOMString &qualifiedName,	//DOM Level 2
  -		const DOMString &publicId, const DOMString &systemId);
  +    DocumentTypeImpl(DocumentImpl *,
  +                     const DOMString &qualifiedName,	//DOM Level 2
  +                     const DOMString &publicId, const DOMString &systemId);
       DocumentTypeImpl(const DocumentTypeImpl &other, bool deep=false);
       virtual ~DocumentTypeImpl();
       virtual bool isDocumentTypeImpl();
       
       virtual NodeImpl *         cloneNode(bool deep);
  +    virtual void setOwnerDocument(DocumentImpl *doc);
       virtual DOMString getNodeName();
       virtual short getNodeType();
       virtual NamedNodeMapImpl * getEntities();
  @@ -117,9 +119,6 @@
       virtual DOMString     getPublicId();
       virtual DOMString     getSystemId();
       virtual DOMString     getInternalSubset();
  -    //internal use only
  -    virtual void setOwnerDocument(DocumentImpl *docImpl);
  -    virtual DocumentTypeImpl *exportNode(DocumentImpl *docImpl, bool deep);
   };
   
   #endif
  
  
  
  1.21      +21 -11    xml-xerces/c/src/dom/ElementImpl.cpp
  
  Index: ElementImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/ElementImpl.cpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ElementImpl.cpp	2000/04/19 02:26:16	1.20
  +++ ElementImpl.cpp	2000/04/27 02:52:43	1.21
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: ElementImpl.cpp,v 1.20 2000/04/19 02:26:16 aruna1 Exp $
  + * $Id: ElementImpl.cpp,v 1.21 2000/04/27 02:52:43 lehors Exp $
    */
   
   #include "DeepNodeListImpl.hpp"
  @@ -70,7 +70,7 @@
   
   
   ElementImpl::ElementImpl(DocumentImpl *ownerDoc, const DOMString &eName)
  -    : NodeContainer(ownerDoc)
  +    : ChildAndParentNode(ownerDoc)
   {
       name = eName.clone();
       attributes = new NamedNodeMapImpl(this);
  @@ -78,7 +78,7 @@
   
   
   ElementImpl::ElementImpl(const ElementImpl &other, bool deep)
  -    : NodeContainer(other)
  +    : ChildAndParentNode(other)
   {
       name = other.name.clone();
       if (deep)
  @@ -103,6 +103,16 @@
   };
   
   
  +/**
  + * NON-DOM
  + * set the ownerDocument of this node, its children, and its attributes
  + */
  +void ElementImpl::setOwnerDocument(DocumentImpl *doc) {
  +    ChildAndParentNode::setOwnerDocument(doc);
  +    attributes->setOwnerDocument(doc);
  +}
  +
  +
   DOMString ElementImpl::getNodeName() {
       return name;
   };
  @@ -155,7 +165,7 @@
   
   void ElementImpl::removeAttribute(const DOMString &nam)
   {
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
       
  @@ -173,7 +183,7 @@
   
   AttrImpl *ElementImpl::removeAttributeNode(AttrImpl *oldAttr)
   {
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
       
  @@ -195,7 +205,7 @@
   
   AttrImpl *ElementImpl::setAttribute(const DOMString &nam, const DOMString &val)
   {
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
       
  @@ -216,7 +226,7 @@
   
   AttrImpl * ElementImpl::setAttributeNode(AttrImpl *newAttr)
   {
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
       
  @@ -249,7 +259,7 @@
   
   void ElementImpl::setReadOnly(bool readOnl, bool deep)
   {
  -    NodeContainer::setReadOnly(readOnl,deep);
  +    ChildAndParentNode::setReadOnly(readOnl,deep);
       attributes->setReadOnly(readOnl,true);
   };
   
  @@ -267,7 +277,7 @@
   AttrImpl *ElementImpl::setAttributeNS(const DOMString &fNamespaceURI,
   	const DOMString &qualifiedName, const DOMString &fValue)
   {
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(
   	    DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
       
  @@ -288,7 +298,7 @@
   void ElementImpl::removeAttributeNS(const DOMString &fNamespaceURI,
   	const DOMString &fLocalName)
   {
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(
   	    DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
       
  @@ -312,7 +322,7 @@
   
   AttrImpl *ElementImpl::setAttributeNodeNS(AttrImpl *newAttr)
   {
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(
   	    DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
       
  
  
  
  1.12      +5 -3      xml-xerces/c/src/dom/ElementImpl.hpp
  
  Index: ElementImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/ElementImpl.hpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ElementImpl.hpp	2000/04/06 23:59:23	1.11
  +++ ElementImpl.hpp	2000/04/27 02:52:43	1.12
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: ElementImpl.hpp,v 1.11 2000/04/06 23:59:23 lehors Exp $
  + * $Id: ElementImpl.hpp,v 1.12 2000/04/27 02:52:43 lehors Exp $
    */
   
   //
  @@ -73,11 +73,11 @@
   
   #include <util/XercesDefs.hpp>
   #include "AttrImpl.hpp"
  -#include "NodeContainer.hpp"
  +#include "ChildAndParentNode.hpp"
   
   class DeepNodeListImpl;
   
  -class CDOM_EXPORT ElementImpl: public NodeContainer {
  +class CDOM_EXPORT ElementImpl: public ChildAndParentNode {
   protected:
       DOMString name;
       NamedNodeMapImpl *attributes;
  @@ -115,6 +115,8 @@
       virtual AttrImpl *setAttributeNodeNS(AttrImpl *newAttr);
       virtual DeepNodeListImpl *getElementsByTagNameNS(const DOMString \
&namespaceURI,  const DOMString &localName);
  +
  +    virtual void setOwnerDocument(DocumentImpl *doc);
   };
   
   #endif
  
  
  
  1.3       +2 -4      xml-xerces/c/src/dom/ElementNSImpl.cpp
  
  Index: ElementNSImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/ElementNSImpl.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ElementNSImpl.cpp	2000/04/06 19:23:57	1.2
  +++ ElementNSImpl.cpp	2000/04/27 02:52:43	1.3
  @@ -55,15 +55,13 @@
    */
   
   /*
  - * $Id: ElementNSImpl.cpp,v 1.2 2000/04/06 19:23:57 lehors Exp $
  + * $Id: ElementNSImpl.cpp,v 1.3 2000/04/27 02:52:43 lehors Exp $
    */
   
   #include "ElementNSImpl.hpp"
   #include "DocumentImpl.hpp"
   #include "DOM_DOMException.hpp"
   
  -#define null 0
  -
   ElementNSImpl::ElementNSImpl(DocumentImpl *ownerDoc, const DOMString &nam) :
       ElementImpl(ownerDoc, name)
   {
  @@ -135,7 +133,7 @@
       DOMString xmlns = NodeImpl::getXmlnsString();
       DOMString xmlnsURI = NodeImpl::getXmlnsURIString();
   
  -    if (readOnly)
  +    if (readOnly())
           throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR,
                                  null);
       if(prefix != null && !DocumentImpl::isXMLName(prefix))
  
  
  
  1.12      +7 -26     xml-xerces/c/src/dom/EntityImpl.cpp
  
  Index: EntityImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/EntityImpl.cpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- EntityImpl.cpp	2000/04/19 02:26:16	1.11
  +++ EntityImpl.cpp	2000/04/27 02:52:43	1.12
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: EntityImpl.cpp,v 1.11 2000/04/19 02:26:16 aruna1 Exp $
  + * $Id: EntityImpl.cpp,v 1.12 2000/04/27 02:52:43 lehors Exp $
    */
   
   #include "DOM_DOMException.hpp"
  @@ -64,17 +64,17 @@
   
   
   EntityImpl::EntityImpl(DocumentImpl *ownerDoc, const DOMString &eName)
  -   : NodeContainer(ownerDoc),
  +   : ParentNode(ownerDoc),
   	refEntity(0)
   
   {
       name        = eName.clone();
  -    readOnly    = true;
  +    readOnly(true);
   };
   
   
   EntityImpl::EntityImpl(const EntityImpl &other, bool deep)
  -    : NodeContainer(other)
  +    : ParentNode(other)
   {
       name            = other.name.clone();
       if (deep)
  @@ -83,7 +83,7 @@
       systemId        = other.systemId.clone();
       notationName    = other.notationName.clone();
       refEntity       = other.refEntity;	
  -    readOnly        = true;
  +    readOnly(true);
   };
   
   
  @@ -107,13 +107,6 @@
   };
   
   
  -// Notation nodes do not have a parent
  -NodeImpl * EntityImpl::getParentNode()
  -{
  -    return 0;
  -};
  -
  -
   DOMString EntityImpl::getNotationName()
   {
       return notationName;
  @@ -185,7 +178,7 @@
   NodeImpl*   EntityImpl::getLastChild() 
   {
   	cloneEntityRefTree();
  -	return lastChild;
  +	return lastChild();
   }
   
   NodeListImpl* EntityImpl::getChildNodes() 
  @@ -204,20 +197,8 @@
   NodeImpl* EntityImpl::item(unsigned int index) 
   {
   	cloneEntityRefTree();
  -    NodeImpl *node = firstChild;
  +    ChildNode *node = firstChild;
       for(unsigned int i=0; i<index && node!=null; ++i)
           node = node->nextSibling;
       return node;
  -}
  -
  -NodeImpl * EntityImpl::getNextSibling()
  -{
  -	cloneEntityRefTree();
  -	return nextSibling;
  -}
  -
  -NodeImpl*  EntityImpl::getPreviousSibling()
  -{
  -	cloneEntityRefTree();
  -	return previousSibling;
   }
  
  
  
  1.11      +3 -6      xml-xerces/c/src/dom/EntityImpl.hpp
  
  Index: EntityImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/EntityImpl.hpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- EntityImpl.hpp	2000/04/19 02:26:16	1.10
  +++ EntityImpl.hpp	2000/04/27 02:52:43	1.11
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: EntityImpl.hpp,v 1.10 2000/04/19 02:26:16 aruna1 Exp $
  + * $Id: EntityImpl.hpp,v 1.11 2000/04/27 02:52:43 lehors Exp $
    */
   
   //
  @@ -71,11 +71,11 @@
   //
   
   #include <util/XercesDefs.hpp>
  -#include "NodeContainer.hpp"
  +#include "ParentNode.hpp"
   #include "EntityReferenceImpl.hpp"
   
   
  -class CDOM_EXPORT EntityImpl: public NodeContainer {
  +class CDOM_EXPORT EntityImpl: public ParentNode {
   private:
       DOMString name;
       DOMString publicId;
  @@ -95,7 +95,6 @@
       virtual NodeImpl*   cloneNode(bool deep);
       virtual DOMString getNodeName();
       virtual short getNodeType();
  -    virtual NodeImpl*   getParentNode();
       virtual DOMString   getPublicId();
       virtual DOMString   getSystemId();
       virtual DOMString   getNotationName();
  @@ -109,8 +108,6 @@
   	virtual NodeListImpl* getChildNodes();
   	virtual bool		hasChildNodes();
   	virtual NodeImpl*   item(unsigned int index);
  -	virtual NodeImpl*   getNextSibling();
  -	virtual NodeImpl*   getPreviousSibling();
   
   	//DOM Level 2 additions. Non standard functions
   	virtual void		setEntityRef(EntityReferenceImpl*);
  
  
  
  1.13      +7 -48     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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- EntityReferenceImpl.cpp	2000/04/19 02:26:16	1.12
  +++ EntityReferenceImpl.cpp	2000/04/27 02:52:44	1.13
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: EntityReferenceImpl.cpp,v 1.12 2000/04/19 02:26:16 aruna1 Exp $
  + * $Id: EntityReferenceImpl.cpp,v 1.13 2000/04/27 02:52:44 lehors Exp $
    */
   
   /**
  @@ -122,12 +122,12 @@
   
   EntityReferenceImpl::EntityReferenceImpl(DocumentImpl *ownerDoc,
                                            const DOMString &entityName)
  -    : NodeContainer(ownerDoc)
  +    : ChildAndParentNode(ownerDoc)
   {
       name = entityName.clone();
       // EntityReference behaves as a read-only node, since its contents
       // reflect the Entity it refers to -- but see setNodeName().
  -    readOnly = true;
  +    readOnly(true);
       entityChanges=-1;
   }
   
  @@ -135,13 +135,13 @@
   
   EntityReferenceImpl::EntityReferenceImpl(const EntityReferenceImpl &other,
                                            bool deep)
  -    : NodeContainer(other)
  +    : ChildAndParentNode(other)
   {
       name = other.name.clone();
       if (deep)
           cloneChildren(other);
       entityChanges = other.entityChanges;
  -    readOnly = true;
  +    readOnly(true);
   }
   
   
  @@ -169,36 +169,6 @@
   
   
   /**
  -* 
  -* @return org.w3c.dom.NodeList
  -*/
  -NodeListImpl *EntityReferenceImpl::getChildNodes()
  -{
  -    return NodeContainer::getChildNodes();
  -}
  -
  -
  -/**
  -* 
  -* @return org.w3c.dom.NodeList
  -*/
  -NodeImpl *EntityReferenceImpl::getFirstChild()
  -{
  -    return NodeContainer::getFirstChild();
  -}
  -
  -
  -/**
  -* 
  -* @return org.w3c.dom.NodeList
  -*/
  -NodeImpl *EntityReferenceImpl::getLastChild() 
  -{
  -    return NodeContainer::getLastChild();
  -}
  -
  -
  -/**
   * Query the number of children in the entity definition.
   * (A bit more work than asking locally, but may be able to avoid
   * or defer building the clone subtree.)
  @@ -207,7 +177,7 @@
   */
   unsigned int EntityReferenceImpl::getLength()
   {
  -    unsigned int length = NodeContainer::getLength();
  +    unsigned int length = ChildAndParentNode::getLength();
       
   #if (0)                 // Till we add entity nodes to the doc root element.
       
  @@ -257,15 +227,6 @@
   
   
   /**
  -*
  -* @return org.w3c.dom.NodeList
  -*/
  -NodeImpl *EntityReferenceImpl::item(unsigned int index) {
  -    return NodeContainer::item(index);
  -}
  -
  -
  -/**
   * EntityReferences never have a nodeValue.
   * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR)
   */
  @@ -287,7 +248,5 @@
   {
       if(readOnl==false)
           throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR,null);
                
  -    NodeContainer::setReadOnly(readOnl,deep);
  +    ChildAndParentNode::setReadOnly(readOnl,deep);
   }
  -
  -
  
  
  
  1.12      +3 -7      xml-xerces/c/src/dom/EntityReferenceImpl.hpp
  
  Index: EntityReferenceImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/EntityReferenceImpl.hpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- EntityReferenceImpl.hpp	2000/04/19 02:26:17	1.11
  +++ EntityReferenceImpl.hpp	2000/04/27 02:52:44	1.12
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: EntityReferenceImpl.hpp,v 1.11 2000/04/19 02:26:17 aruna1 Exp $
  + * $Id: EntityReferenceImpl.hpp,v 1.12 2000/04/27 02:52:44 lehors Exp $
    */
   
   //
  @@ -71,9 +71,9 @@
   //
   
   #include <util/XercesDefs.hpp>
  -#include "NodeContainer.hpp"
  +#include "ChildAndParentNode.hpp"
   
  -class CDOM_EXPORT EntityReferenceImpl: public NodeContainer
  +class CDOM_EXPORT EntityReferenceImpl: public ChildAndParentNode
   {
   private:
       DOMString name;
  @@ -86,13 +86,9 @@
       virtual NodeImpl * cloneNode(bool deep);
       virtual DOMString getNodeName();
       virtual short getNodeType();
  -    virtual NodeListImpl *getChildNodes();
  -    virtual NodeImpl *getFirstChild();
  -    virtual NodeImpl *getLastChild();
       virtual unsigned int getLength();
       virtual bool hasChildNodes();
       virtual bool isEntityReference();
  -    virtual NodeImpl *item(unsigned int index);
       virtual void setNodeValue(const DOMString &);
       virtual void setReadOnly(bool readOnly,bool deep);
   };
  
  
  
  1.14      +43 -39    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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- NamedNodeMapImpl.cpp	2000/04/19 02:26:17	1.13
  +++ NamedNodeMapImpl.cpp	2000/04/27 02:52:44	1.14
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: NamedNodeMapImpl.cpp,v 1.13 2000/04/19 02:26:17 aruna1 Exp $
  + * $Id: NamedNodeMapImpl.cpp,v 1.14 2000/04/27 02:52:44 lehors Exp $
    */
   
   #include "NamedNodeMapImpl.hpp"
  @@ -111,6 +111,7 @@
           {
               NodeImpl *n = nodes->elementAt(i)->cloneNode(true);
               n->ownerNode = ownerNode;
  +            n->owned(true);
               newmap->nodes->addElement(n);
           }
       }
  @@ -139,7 +140,8 @@
           for (int i=nodes->size()-1; i>=0; i--)
           {
               NodeImpl *n = nodes->elementAt(i);
  -            n->ownerNode = null;
  +            n->ownerNode = ownerNode->getOwnerDocument();
  +            n->owned(false);
               if (n->nodeRefCount == 0)
                   NodeImpl::deleteIf(n);
           }
  @@ -233,14 +235,11 @@
       
       if(i<0)
           throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null);
  -    else
  -    {
  -        n = (NodeImpl *) (nodes->elementAt(i));
  -        nodes->removeElementAt(i);
  -        
  -        n->ownerNode = null;
  -    }
  -    
  +
  +    n = (NodeImpl *) (nodes->elementAt(i));
  +    nodes->removeElementAt(i);
  +    n->ownerNode = ownerNode->getOwnerDocument();
  +    n->owned(false);
       return n;
   };
   
  @@ -263,10 +262,15 @@
   //
   NodeImpl * NamedNodeMapImpl::setNamedItem(NodeImpl * arg)
   {
  -    if(arg->getOwnerDocument()!= ownerNode->ownerDocument)
  +    if(arg->getOwnerDocument()!= ownerNode->getOwnerDocument())
           throw DOM_DOMException(DOM_DOMException::WRONG_DOCUMENT_ERR,null);
  +    if (readOnly)
  +        throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, \
null);  +    if (arg->owned())
  +        throw DOM_DOMException(DOM_DOMException::INUSE_ATTRIBUTE_ERR,null);
       
       arg->ownerNode = ownerNode;
  +    arg->owned(true);
       int i=findNamePoint(arg->getNodeName());
       NodeImpl * previous=null;
       if(i>=0)
  @@ -281,8 +285,10 @@
               nodes=new NodeVector();
           nodes->insertElementAt(arg,i);
       }
  -    if (previous != null)
  -        previous->ownerNode = null;
  +    if (previous != null) {
  +        previous->ownerNode = ownerNode->getOwnerDocument();
  +        previous->owned(false);
  +    }
   
       return previous;
   };
  @@ -306,25 +312,6 @@
   
   //Introduced in DOM Level 2
   
  -/** Export this object to a different node (and document).
  - */
  -NamedNodeMapImpl *NamedNodeMapImpl::exportNode(NodeImpl *node)
  -{
  -    NamedNodeMapImpl *newmap = new NamedNodeMapImpl(node);
  -    if (nodes != null)
  -    {
  -        newmap->nodes = new NodeVector(nodes->size());
  -        for (unsigned int i = 0; i < nodes->size(); ++i)
  -        {
  -            NodeImpl *n =
  -                node->ownerDocument->importNode(nodes->elementAt(i), true);
  -            n->ownerNode = ownerNode;
  -            newmap->nodes->addElement(n);
  -        }
  -    }
  -    return newmap;
  -}
  -
   int NamedNodeMapImpl::findNamePoint(const DOMString &namespaceURI,
   	const DOMString &localName)
   {
  @@ -362,14 +349,15 @@
   //
   NodeImpl * NamedNodeMapImpl::setNamedItemNS(NodeImpl *arg)
   {
  -   if(arg->getOwnerDocument() != ownerNode->ownerDocument)
  +    if (arg->getOwnerDocument() != ownerNode->getOwnerDocument())
           throw DOM_DOMException(DOM_DOMException::WRONG_DOCUMENT_ERR,null);   
       if (readOnly)
  -	throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, null);
  -    if (arg->ownerNode)
  +        throw DOM_DOMException(DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, \
null);  +    if (arg->owned())
           throw DOM_DOMException(DOM_DOMException::INUSE_ATTRIBUTE_ERR,null);
       
       arg->ownerNode = ownerNode;
  +    arg->owned(true);
       int i=findNamePoint(arg->getNamespaceURI(), arg->getLocalName());
       NodeImpl *previous=null;
       if(i>=0) {
  @@ -380,9 +368,11 @@
           if(null==nodes)
               nodes=new NodeVector();
           nodes->insertElementAt(arg,i);
  +    }
  +    if (previous != null) {
  +        previous->ownerNode = ownerNode->getOwnerDocument();
  +        previous->owned(false);
       }
  -    if (previous != null)
  -        previous->ownerNode = null;
   
       return previous;
   };
  @@ -402,9 +392,23 @@
       int i = findNamePoint(namespaceURI, localName);
       if (i < 0)
           throw DOM_DOMException(DOM_DOMException::NOT_FOUND_ERR, null);
  +
       NodeImpl * n = nodes -> elementAt(i);   
  -    
       nodes -> removeElementAt(i);	//remove n from nodes
  -    n -> ownerNode = null;
  +    n->ownerNode = ownerNode->getOwnerDocument();
  +    n->owned(false);
       return n;
   }
  +
  +/**
  + * NON-DOM
  + * set the ownerDocument of this node, its children, and its attributes
  + */
  +void NamedNodeMapImpl::setOwnerDocument(DocumentImpl *doc) {
  +    if (nodes != null) {
  +        for (unsigned int i = 0; i < nodes->size(); i++) {
  +            item(i)->setOwnerDocument(doc);
  +        }
  +    }
  +}
  +
  
  
  
  1.12      +3 -43     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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- NamedNodeMapImpl.hpp	2000/04/19 02:26:17	1.11
  +++ NamedNodeMapImpl.hpp	2000/04/27 02:52:44	1.12
  @@ -58,51 +58,7 @@
    */
   
   /*
  - * $Log: NamedNodeMapImpl.hpp,v $
  - * Revision 1.11  2000/04/19 02:26:17  aruna1
  - * Full support for DOM_EntityReference, DOM_Entity and DOM_DocumentType \
                introduced
  - *
  - * Revision 1.10  2000/04/07 20:58:36  lehors
  - * fixed all cloneMap so that the ownerNode is correct
  - *
  - * Revision 1.9  2000/04/06 21:17:48  lehors
  - * got rid of the owned attribute,
  - * renamed parentNode to ownerNode to make it clear it's not always the parent
  - *
  - * Revision 1.8  2000/03/02 19:54:02  roddey
  - * This checkin includes many changes done while waiting for the
  - * 1.1.0 code to be finished. I can't list them all here, but a list is
  - * available elsewhere.
  - *
  - * Revision 1.7  2000/02/24 20:11:30  abagchi
  - * Swat for removing Log from API docs
  - *
  - * Revision 1.6  2000/02/06 07:47:33  rahulj
  - * Year 2K copyright swat.
  - *
  - * Revision 1.5  2000/02/04 01:49:26  aruna1
  - * TreeWalker and NodeIterator changes
  - *
  - * Revision 1.4  2000/01/22 01:38:30  andyh
  - * Remove compiler warnings in DOM impl classes
  - *
  - * 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.
  - *
  - * Revision 1.1.1.1  1999/11/09 01:09:12  twl
  - * Initial checkin
  - *
  - * Revision 1.3  1999/11/08 20:44:29  rahul
  - * Swat for adding in Product name and CVS comment log variable.
  - *
  + * $Id: NamedNodeMapImpl.hpp,v 1.12 2000/04/27 02:52:44 lehors Exp $
    */
   
   //
  @@ -153,7 +109,6 @@
       virtual void            setReadOnly(bool readOnly, bool deep);
   
       //Introduced in DOM Level 2
  -    virtual NamedNodeMapImpl *exportNode(NodeImpl *node);
       virtual int             findNamePoint(const DOMString &namespaceURI,
   	const DOMString &localName);
       virtual NodeImpl        *getNamedItemNS(const DOMString &namespaceURI,
  @@ -161,6 +116,8 @@
       virtual NodeImpl        *setNamedItemNS(NodeImpl *arg);
       virtual NodeImpl        *removeNamedItemNS(const DOMString &namespaceURI,
   	const DOMString &localName);
  +
  +    virtual void setOwnerDocument(DocumentImpl *doc);
   };
   
   #endif
  
  
  
  1.22      +63 -41    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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- NodeImpl.cpp	2000/04/07 00:51:46	1.21
  +++ NodeImpl.cpp	2000/04/27 02:52:44	1.22
  @@ -55,12 +55,12 @@
    */
   
   /*
  - * $Id: NodeImpl.cpp,v 1.21 2000/04/07 00:51:46 lehors Exp $
  + * $Id: NodeImpl.cpp,v 1.22 2000/04/27 02:52:44 lehors Exp $
    */
   
   // This class doesn't support having any children, and implements the behavior
   // of an empty NodeList as far getChildNodes is concerned.
  -// The NodeContainer subclass overrides this behavior.
  +// The ParentNode subclass overrides this behavior.
   
   #include "NodeImpl.hpp"
   #include "DOM_DOMException.hpp"
  @@ -77,15 +77,21 @@
   static DOMString *s_xmlns = null;
   static DOMString *s_xmlnsURI = null;
   
  +const unsigned short NodeImpl::READONLY     = 0x1<<0;
  +const unsigned short NodeImpl::SYNCDATA     = 0x1<<1;
  +const unsigned short NodeImpl::SYNCCHILDREN = 0x1<<2;
  +const unsigned short NodeImpl::OWNED        = 0x1<<3;
  +const unsigned short NodeImpl::FIRSTCHILD   = 0x1<<4;
  +const unsigned short NodeImpl::SPECIFIED    = 0x1<<5;
  +const unsigned short NodeImpl::IGNORABLEWS  = 0x1<<6;
  +const unsigned short NodeImpl::SETVALUE     = 0x1<<7;
  +
   NodeImpl::NodeImpl(DocumentImpl *ownerDoc)
   {
  -    this->ownerDocument=ownerDoc;
  -    this->changes = 0;
       this->userData = null;
  -    this->readOnly = false;
  -    this->previousSibling  = null;
  -    this->nextSibling  = null;
  -    this->ownerNode  = null;
  +    this->flags = 0;
  +    // as long as we do not have any owner, ownerNode is our ownerDocument
  +    this->ownerNode  = ownerDoc;
       
       this->nodeRefCount = 0;
       NodeImpl::gLiveNodeImpls++; 
  @@ -95,20 +101,18 @@
   // This only makes a shallow copy, cloneChildren must also be called for a
   // deep clone
   NodeImpl::NodeImpl(const NodeImpl &other) {
  -    this->readOnly = false;
  -    this->ownerDocument = other.ownerDocument;
  +    this->flags = other.flags;
       this->userData = other.userData;
  -    this->changes = 0;
  +    this->readOnly(false);
       
       this->nodeRefCount = 0;
       NodeImpl::gLiveNodeImpls++; 
       NodeImpl::gTotalNodeImpls++;
  -    
       
  -    // Need to break the association w/ original siblings and parent
  -    this->previousSibling = null;
  -    this->nextSibling = null;
  -    this->ownerNode = null;
  +    // Need to break the association w/ original parent
  +    //    this->ownerNode = other.getOwnerDocument(); this doesn't work???
  +    this->ownerNode = ((NodeImpl*)&other)->getOwnerDocument();
  +    this->owned(false);
   };
   
       
  @@ -132,20 +136,25 @@
   bool NodeImpl::isEntityReference()       {return false;};
   bool NodeImpl::isTextImpl()              {return false;};
   
  -NodeImpl * NodeImpl::appendChild(NodeImpl *newChild)      
  -{
  -    return insertBefore(newChild, null);
  -};
  -
   
  +void


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic