You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@locus.apache.org on 2000/04/27 18:48:37 UTC

cvs commit: xml-xerces/c/src/dom AttrNSImpl.cpp AttrNSImpl.hpp ElementNSImpl.cpp ElementNSImpl.hpp

lehors      00/04/27 09:48:36

  Modified:    c/src/dom AttrNSImpl.cpp AttrNSImpl.hpp ElementNSImpl.cpp
                        ElementNSImpl.hpp
  Log:
  the prefix is no longer stored but recomputed when necessary
  
  Revision  Changes    Path
  1.4       +9 -8      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AttrNSImpl.cpp	2000/04/27 02:52:42	1.3
  +++ AttrNSImpl.cpp	2000/04/27 16:48:31	1.4
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: AttrNSImpl.cpp,v 1.3 2000/04/27 02:52:42 lehors Exp $
  + * $Id: AttrNSImpl.cpp,v 1.4 2000/04/27 16:48:31 lehors Exp $
    */
   
   #include "AttrNSImpl.hpp"
  @@ -66,7 +66,6 @@
       AttrImpl(ownerDoc, name)
   {
       this->namespaceURI=null;	//DOM Level 2
  -    this->prefix=null;          //DOM Level 2
       this->localName=null;       //DOM Level 2
   }
   
  @@ -81,6 +80,7 @@
       this->name = qualifiedName.clone();
   
       int index = DocumentImpl::indexofQualifiedName(qualifiedName);
  +    DOMString prefix;
       if (index < 0)
   	throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
       bool xmlnsAlone = false;	//true if attribute name is "xmlns"
  @@ -90,10 +90,10 @@
   		throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
   	    xmlnsAlone = true;
   	}
  -	this -> prefix = null;
  +	prefix = null;
   	this -> localName = this -> name;
       } else {	//0 < index < this->name.length()-1
  -	this -> prefix = this->name.substringData(0, index);
  +	prefix = this->name.substringData(0, index);
   	this -> localName =
               this->name.substringData(index+1, this->name.length()-index-1);
       }
  @@ -107,7 +107,6 @@
       AttrImpl(other, deep)
   {
       this->namespaceURI = other.namespaceURI.clone();	//DOM Level 2
  -    this->prefix = other.prefix.clone();                //DOM Level 2
       this->localName = other.localName.clone();          //DOM Level 2
   };
   
  @@ -123,7 +122,11 @@
   
   DOMString AttrNSImpl::getPrefix()
   {
  -    return prefix;
  +    int index = DocumentImpl::indexofQualifiedName(name);
  +    if (index == 0)
  +        return null;
  +    else
  +        return name.substringData(0, index);
   }
   
   DOMString AttrNSImpl::getLocalName()
  @@ -148,7 +151,6 @@
           throw DOM_DOMException(DOM_DOMException::INVALID_CHARACTER_ERR,null);
   
       if (prefix == null || prefix.length() == 0) {
  -        this -> prefix = null;
           name = localName;
           return;
       }
  @@ -162,6 +164,5 @@
           if (*p++ == chColon)	//prefix is malformed
               throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
   
  -    this -> prefix = prefix;
       name = prefix + chColon + localName; //nodeName is changed too
   }
  
  
  
  1.2       +1 -2      xml-xerces/c/src/dom/AttrNSImpl.hpp
  
  Index: AttrNSImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/AttrNSImpl.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AttrNSImpl.hpp	2000/04/06 02:21:21	1.1
  +++ AttrNSImpl.hpp	2000/04/27 16:48:32	1.2
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: AttrNSImpl.hpp,v 1.1 2000/04/06 02:21:21 lehors Exp $
  + * $Id: AttrNSImpl.hpp,v 1.2 2000/04/27 16:48:32 lehors Exp $
    */
   
   //
  @@ -78,7 +78,6 @@
   protected:
       //Introduced in DOM Level 2
       DOMString namespaceURI;     //namespace URI of this node
  -    DOMString prefix;           //namespace prefix of this node
       DOMString localName;        //local part of qualified name
       
       
  
  
  
  1.4       +9 -8      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ElementNSImpl.cpp	2000/04/27 02:52:43	1.3
  +++ ElementNSImpl.cpp	2000/04/27 16:48:32	1.4
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: ElementNSImpl.cpp,v 1.3 2000/04/27 02:52:43 lehors Exp $
  + * $Id: ElementNSImpl.cpp,v 1.4 2000/04/27 16:48:32 lehors Exp $
    */
   
   #include "ElementNSImpl.hpp"
  @@ -66,7 +66,6 @@
       ElementImpl(ownerDoc, name)
   {
       this->namespaceURI=null;	//DOM Level 2
  -    this->prefix=null;          //DOM Level 2
       this->localName=null;       //DOM Level 2
   }
   
  @@ -83,13 +82,14 @@
       this->name = qualifiedName.clone();
   
       int index = DocumentImpl::indexofQualifiedName(qualifiedName);
  +    DOMString prefix;
       if (index < 0)
   	throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
       if (index == 0) {	//qualifiedName contains no ':'
  -	this -> prefix = null;
  +        prefix = null;
   	this -> localName = this -> name;
       } else {	//0 < index < this->name.length()-1
  -	this -> prefix = this->name.substringData(0, index);
  +	prefix = this->name.substringData(0, index);
   	this -> localName =
               this->name.substringData(index+1, this->name.length()-index-1);
       }
  @@ -103,7 +103,6 @@
       ElementImpl(other, deep)
   {
       this->namespaceURI = other.namespaceURI.clone();	//DOM Level 2
  -    this->prefix = other.prefix.clone();                //DOM Level 2
       this->localName = other.localName.clone();          //DOM Level 2
   };
   
  @@ -118,7 +117,11 @@
   
   DOMString ElementNSImpl::getPrefix()
   {
  -    return prefix;
  +    int index = DocumentImpl::indexofQualifiedName(name);
  +    if (index == 0)
  +        return null;
  +    else
  +        return name.substringData(0, index);
   }
   
   DOMString ElementNSImpl::getLocalName()
  @@ -143,7 +146,6 @@
   	throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
   
       if (prefix == null || prefix.length() == 0) {
  -        this -> prefix = null;
           name = localName;
           return;
       }
  @@ -156,6 +158,5 @@
           if (*p++ == chColon)	//prefix is malformed
               throw DOM_DOMException(DOM_DOMException::NAMESPACE_ERR, null);
   
  -    this -> prefix = prefix;
       name = prefix + chColon + localName; //nodeName is changed too
   }
  
  
  
  1.2       +1 -2      xml-xerces/c/src/dom/ElementNSImpl.hpp
  
  Index: ElementNSImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/dom/ElementNSImpl.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ElementNSImpl.hpp	2000/04/06 02:21:21	1.1
  +++ ElementNSImpl.hpp	2000/04/27 16:48:33	1.2
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: ElementNSImpl.hpp,v 1.1 2000/04/06 02:21:21 lehors Exp $
  + * $Id: ElementNSImpl.hpp,v 1.2 2000/04/27 16:48:33 lehors Exp $
    */
   
   //
  @@ -78,7 +78,6 @@
   protected:
       //Introduced in DOM Level 2
       DOMString namespaceURI;     //namespace URI of this node
  -    DOMString prefix;           //namespace prefix of this node
       DOMString localName;        //local part of qualified name