You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2006/11/21 20:30:37 UTC

svn commit: r477840 - /incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp

Author: robbinspg
Date: Tue Nov 21 11:30:37 2006
New Revision: 477840

URL: http://svn.apache.org/viewvc?view=rev&rev=477840
Log:
TUSCANY-907 Apply Caroline's patch

Modified:
    incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp

Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp?view=diff&rev=477840&r1=477839&r2=477840
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp Tue Nov 21 11:30:37 2006
@@ -540,59 +540,29 @@
                                 SDOSchemaSAX2Parser& schemaParser,
                                 SDOXMLString& schemaLocation)
         {
-            int i,j,k;
-            SDOXMLString sl = getCurrentFile();
-          
-            i = sl.lastIndexOf('/');
-            j = sl.lastIndexOf('\\');
-            if ((j > i) || (i < 0))i=j;
-            if (i>=0)
-            {
-                sl = sl.substring(0,i+1) + schemaLocation;
-                try {
-                     if (-1 != schemaParser.parse((const char *)sl))
-                         return 1;
-                }
-                catch (SDORuntimeException e)
-                {
-                }
-                k = schemaLocation.lastIndexOf('/');
-                j = schemaLocation.lastIndexOf('\\');
-                if ((j > k) || (k < 0))k=j;
-                if (k>=0)
-                {
-                    sl = sl.substring(0,i+1) + schemaLocation.substring(0,k+1);
-                    try {
-                        if (-1 != schemaParser.parse((const char *)sl))
-                             return 1;
-                    }
-                    catch (SDORuntimeException e)
-                    {
-                    }
-                }
-            }
-            try {
-                if (-1 != schemaParser.parse((const char *)schemaLocation))
-                    return 1;
-            }
-            catch (SDORuntimeException e)
-            {
-            }
-            k = schemaLocation.lastIndexOf('/');
-            j = schemaLocation.lastIndexOf('\\');
-            if ((j > k) || (k < 0))k=j;
-            if (k>=0)
-            {
-                sl = schemaLocation.substring(0,k+1);
-                try {
-                    if (-1 != schemaParser.parse((const char *)sl))
-                        return 1;
-                }
-                catch (SDORuntimeException e)
-                {
-                }
-            }
-            return 0;
+            int i,j;
+			xmlChar *absoluteUri;
+
+			SDOXMLString sl = getCurrentFile();
+
+			/*
+			* Build an absolute URL using the current file as the base and
+			* the schemaLocation as the relative part, using the rules in
+			* RFC 2396 5.2. Resolving Relative References to Absolute Form
+			*/
+			try {
+				absoluteUri = xmlBuildURI((const xmlChar *)schemaLocation, (const xmlChar *)sl);
+				if (-1 != schemaParser.parse((const char *)absoluteUri)) {
+					xmlFree(absoluteUri);
+					return 1;
+				}
+			}
+			catch (SDORuntimeException e)
+			{
+			}
+			if (absoluteUri) xmlFree(absoluteUri);
+			
+			return 0;
         }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org