[ofbiz-plugins] branch trunk updated: Fixed: Flexible reports use an old noNamespaceSchemaLocation (OFBIZ-12039)

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

[ofbiz-plugins] branch trunk updated: Fixed: Flexible reports use an old noNamespaceSchemaLocation (OFBIZ-12039)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 908db34  Fixed: Flexible reports use an old noNamespaceSchemaLocation (OFBIZ-12039)
908db34 is described below

commit 908db3444972f5f6cb4c71ea3de8abd546cc7979
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Sun Oct 4 11:26:27 2020 +0200

    Fixed: Flexible reports use an old noNamespaceSchemaLocation (OFBIZ-12039)
   
    While working on using flexible reports during this discussion
    (https://markmail.org/message/qgebmemkqb6ddgzw)
    I found this kind of errors in log:
   
    XmlFileLoader: File Internal Content process error. Line: 20. Error message:
    TargetNamespace.2: Expecting no namespace, but the schema document has a target
     namespace of 'http://ofbiz.apache.org/Widget-Form'.
   
    Turned out that it was due to an old use of noNamespaceSchemaLocation when
    dynamically creating forms.
   
    The fix is to use the same definition than in current forms.
   
    Thanks: Georg Potthast for starting the discussion
---
 birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java            | 6 ++++--
 birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java | 5 ++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java b/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
index 1827b6c..50c412e 100644
--- a/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
+++ b/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
@@ -260,8 +260,10 @@ public final class BirtWorker {
         String reportForm = (String) resultElectronicText.get("textData");
         if (!reportForm.startsWith("<?xml")) {
             StringBuffer xmlHeaderForm = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
-            xmlHeaderForm.append("<forms xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://ofbiz"
-                    + ".apache.org/dtds/widget-form.xsd\">");
+            xmlHeaderForm.append("<forms xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+                    + "xmlns=\"http://ofbiz.apache.org/Widget-Form\" "
+                    + "xsi:schemaLocation=\"http://ofbiz.apache.org/Widget-Form "
+                    + "http://ofbiz.apache.org/dtds/widget-form.xsd\">");
             xmlHeaderForm.append(reportForm);
             xmlHeaderForm.append("</forms>");
             reportForm = xmlHeaderForm.toString();
diff --git a/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java b/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java
index ace537f..01551c4 100644
--- a/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java
+++ b/birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java
@@ -327,7 +327,10 @@ public class BirtServices {
             GenericValue content = EntityQuery.use(delegator).from("Content").where("contentId", reportContentId).queryOne();
             String dataResourceId = content.getString("dataResourceId");
             StringBuffer newForm = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?> <forms xmlns:xsi=\"http://www.w3"
-                    + ".org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://ofbiz.apache.org/dtds/widget-form.xsd\">");
+                    + ".org/2001/XMLSchema-instance\" "
+                    + "xmlns=\"http://ofbiz.apache.org/Widget-Form\" "
+                    + "xsi:schemaLocation=\"http://ofbiz.apache.org/Widget-Form "
+                    + "http://ofbiz.apache.org/dtds/widget-form.xsd\">");
             newForm.append(overrideFilters);
             newForm.append("</forms>");
             Document xmlForm = UtilXml.readXmlDocument(newForm.toString());