svn commit: r810857 - /ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r810857 - /ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java

jacopoc
Author: jacopoc
Date: Thu Sep  3 09:55:14 2009
New Revision: 810857

URL: http://svn.apache.org/viewvc?rev=810857&view=rev
Log:
Fix for issue happening after that Xalan jars have been added to the classpath: namespaces were added to each and every element.
Thanks to Ashish Vijaywargiya for the bug report and tests.


Modified:
    ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java

Modified: ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java?rev=810857&r1=810856&r2=810857&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java (original)
+++ ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java Thu Sep  3 09:55:14 2009
@@ -349,12 +349,11 @@
 
             Document feedDocument = UtilXml.makeEmptyXmlDocument("feed");
             Element feedElem = feedDocument.getDocumentElement();
-            feedElem.setAttribute("xmlns", "http://www.w3.org/2005/Atom");
-            feedElem.setAttribute("xmlns:openSearch", "http://a9.com/-/spec/opensearchrss/1.0/");
-            feedElem.setAttribute("xmlns:g", "http://base.google.com/ns/1.0");
-            feedElem.setAttribute("xmlns:gm", "http://base.google.com/ns-metadata/1.0");
-            feedElem.setAttribute("xmlns:batch", "http://schemas.google.com/gdata/batch");
-            feedElem.setAttribute("xmlns:app", "http://purl.org/atom/app#");
+            feedElem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", "http://www.w3.org/2005/Atom");
+            feedElem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:gm", googleBaseMetadataUrl);
+            feedElem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:g", googleBaseNSUrl);
+            feedElem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:batch", googleBaseBatchUrl);
+            feedElem.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:app", googleBaseAppUrl);
 
             // Iterate the product list getting all the relevant data
             Iterator productsListItr = productsList.iterator();
@@ -369,8 +368,8 @@
                     Debug.logInfo("Price not found for product [" + prod.getString("productId")+ "]; product will not be exported.", module);
                     continue;
                 }
-                // TODO: improve this (i.e. get the relative path from the properies file)
-                String link = webSiteUrl + "/"+webSiteMountPoint+"/control/product/~product_id=" + prod.getString("productId") + trackingCodeId;
+                // TODO: improve this (i.e. get the relative path from the properties file)
+                String link = webSiteUrl + "/" + webSiteMountPoint + "/control/product/~product_id=" + prod.getString("productId") + trackingCodeId;
                 String title = UtilFormatOut.encodeXmlValue(prod.getString("productName"));
                 if (UtilValidate.isEmpty(title)) {
                     title = UtilFormatOut.encodeXmlValue(prod.getString("internalName"));
@@ -501,7 +500,7 @@
                 }
                 index++;
             }
-            //Debug.logInfo("The value of generated String is ======== " + UtilXml.writeXmlDocument(feedDocument), module);
+            //Debug.logInfo("The value of generated String is ========\n" + UtilXml.writeXmlDocument(feedDocument), module);
             dataItemsXml.append(UtilXml.writeXmlDocument(feedDocument));
         } catch (IOException e) {
             return ServiceUtil.returnError("IO Error creating XML document for Google :" + e.getMessage());