cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r620138 - /incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
Date Sat, 09 Feb 2008 15:21:37 GMT
Author: dkulp
Date: Sat Feb  9 07:21:36 2008
New Revision: 620138

URL: http://svn.apache.org/viewvc?rev=620138&view=rev
Log:
Fix generated schemas I broke last night


Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java?rev=620138&r1=620137&r2=620138&view=diff
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
(original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/AbstractDataBinding.java
Sat Feb  9 07:21:36 2008
@@ -20,6 +20,7 @@
 package org.apache.cxf.databinding;
 
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -32,6 +33,7 @@
 
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
+import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.ws.commons.schema.XmlSchema;
@@ -40,6 +42,13 @@
  * Supply default implementations, as appropriate, for DataBinding. 
  */
 public abstract class AbstractDataBinding implements DataBinding {
+    private static final Map<String, String> BUILTIN_SCHEMA_LOCS = new HashMap<String,
String>();
+    {
+        BUILTIN_SCHEMA_LOCS.put("http://www.w3.org/2005/08/addressing",
+                     "http://www.w3.org/2006/03/addressing/ws-addr.xsd");
+    }
+    
+    
     protected int mtomThreshold;
     
     private Collection<DOMSource> schemas;
@@ -68,9 +77,11 @@
                 Element e = (Element)n;
                 if (e.getLocalName().equals("import")) {
                     e.removeAttribute("schemaLocation");
+                    updateSchemaLocation(e);
                 }
             }
         }
+        XMLUtils.printDOM(d);
         SchemaInfo schema = new SchemaInfo(serviceInfo, ns);
         schema.setSystemId(systemId);
         XmlSchema xmlSchema = col.read(d, null);
@@ -79,6 +90,14 @@
         return xmlSchema;
     }
     
+    protected void updateSchemaLocation(Element e) {
+        String ns = e.getAttribute("namespace");
+        String newLoc = BUILTIN_SCHEMA_LOCS.get(ns);
+        if (newLoc != null) {
+            e.setAttribute("schemaLocation", newLoc);
+        }
+    }
+
     /**
       * @return Returns the namespaceMap.
      */



Mime
View raw message