Author: amassari
Date: Tue Aug  9 10:48:47 2005
New Revision: 231069

URL: http://svn.apache.org/viewcvs?rev=231069&view=rev
Log:
If a document didn't have a base URI, DOMElement::getBaseURI was always 
returning NULL even if they had an xml:base attribute

Modified:
    xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMElementNSImpl.cpp

Modified: xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMElementNSImpl.cpp
URL: 
http://svn.apache.org/viewcvs/xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMElementNSImpl.cpp?rev=231069&r1=231068&r2=231069&view=diff
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMElementNSImpl.cpp 
(original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/dom/impl/DOMElementNSImpl.cpp Tue 
Aug  9 10:48:47 2005
@@ -90,18 +90,22 @@
         if (attrNode) {
             const XMLCh* uri =  attrNode->getNodeValue();
             if (uri && *uri) {// attribute value is always empty string
-                try {
-                    XMLUri temp(baseURI, ((DOMDocumentImpl 
*)this->getOwnerDocument())->getMemoryManager());
-                    XMLUri temp2(&temp, uri, ((DOMDocumentImpl 
*)this->getOwnerDocument())->getMemoryManager());
-                    uri = ((DOMDocumentImpl 
*)this->getOwnerDocument())->cloneString(temp2.getUriText());
-                }
-                catch(const OutOfMemoryException&)
+                // if there is a base URI for the parent node, use it to 
resolve relative URI
+                if(baseURI)
                 {
-                    throw;
-                }
-                catch (...){
-                    // REVISIT: what should happen in this case?
-                    return 0;
+                    try {
+                        XMLUri temp(baseURI, ((DOMDocumentImpl 
*)this->getOwnerDocument())->getMemoryManager());
+                        XMLUri temp2(&temp, uri, ((DOMDocumentImpl 
*)this->getOwnerDocument())->getMemoryManager());
+                        uri = ((DOMDocumentImpl 
*)this->getOwnerDocument())->cloneString(temp2.getUriText());
+                    }
+                    catch(const OutOfMemoryException&)
+                    {
+                        throw;
+                    }
+                    catch (...){
+                        // REVISIT: what should happen in this case?
+                        return 0;
+                    }
                 }
                 return uri;
             }



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

Reply via email to