amassari    2004/09/14 13:10:20

  Modified:    c/src/xercesc/dom/impl DOMAttrNSImpl.cpp
                        DOMElementNSImpl.cpp
  Log:
  setPrefix doesn't allow an empty string as a valid prefix (jira#1248)
  
  Revision  Changes    Path
  1.16      +8 -7      xml-xerces/c/src/xercesc/dom/impl/DOMAttrNSImpl.cpp
  
  Index: DOMAttrNSImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMAttrNSImpl.cpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DOMAttrNSImpl.cpp 8 Sep 2004 13:55:51 -0000       1.15
  +++ DOMAttrNSImpl.cpp 14 Sep 2004 20:10:20 -0000      1.16
  @@ -78,24 +78,25 @@
   
   void DOMAttrNSImpl::setPrefix(const XMLCh *prefix)
   {
  -    const XMLCh * xml = DOMNodeImpl::getXmlString();
  -    const XMLCh * xmlURI = DOMNodeImpl::getXmlURIString();
       const XMLCh * xmlns = DOMNodeImpl::getXmlnsString();
  -    const XMLCh * xmlnsURI = DOMNodeImpl::getXmlnsURIString();
   
       if (fNode.isReadOnly())
           throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, 
GetDOMNodeMemoryManager);
       if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull || 
XMLString::equals(fLocalName, xmlns))
           throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
   
  -    if (prefix != 0 && !((DOMDocumentImpl 
*)this->getOwnerDocument())->isXMLName(prefix))
  -        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, 
GetDOMNodeMemoryManager);
  -
       if (prefix == 0 || prefix[0] == chNull) {
           fName = fLocalName;
           fPrefix = 0;
           return;
       }
  +
  +    if (!((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(prefix))
  +        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, 
GetDOMNodeMemoryManager);
  +
  +    const XMLCh * xml = DOMNodeImpl::getXmlString();
  +    const XMLCh * xmlURI = DOMNodeImpl::getXmlURIString();
  +    const XMLCh * xmlnsURI = DOMNodeImpl::getXmlnsURIString();
   
       if (XMLString::equals(prefix, xml)&&
           !XMLString::equals(fNamespaceURI, xmlURI)||
  
  
  
  1.20      +7 -7      xml-xerces/c/src/xercesc/dom/impl/DOMElementNSImpl.cpp
  
  Index: DOMElementNSImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMElementNSImpl.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DOMElementNSImpl.cpp      8 Sep 2004 13:55:51 -0000       1.19
  +++ DOMElementNSImpl.cpp      14 Sep 2004 20:10:20 -0000      1.20
  @@ -109,14 +109,8 @@
   
   void DOMElementNSImpl::setPrefix(const XMLCh *prefix)
   {
  -    const XMLCh * xml      = DOMNodeImpl::getXmlString();
  -    const XMLCh * xmlURI   = DOMNodeImpl::getXmlURIString();
  -
       if (fNode.isReadOnly())
           throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, 
GetDOMNodeMemoryManager);
  -    if(prefix != 0 && !((DOMDocumentImpl 
*)this->getOwnerDocument())->isXMLName(prefix))
  -        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, 
GetDOMNodeMemoryManager);
  -
       if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull)
           throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
   
  @@ -125,6 +119,12 @@
           fName = fLocalName;
           return;
       }
  +
  +    if(!((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(prefix))
  +        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, 
GetDOMNodeMemoryManager);
  +
  +    const XMLCh * xml      = DOMNodeImpl::getXmlString();
  +    const XMLCh * xmlURI   = DOMNodeImpl::getXmlURIString();
   
       if (XMLString::equals(prefix, xml) &&
           !XMLString::equals(fNamespaceURI, xmlURI))
  
  
  

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

Reply via email to