This is an automated email from the ASF dual-hosted git repository.

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


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

commit b8c43a178a217214c692d5dda4f2d1528a63df37
Author: Jacques Le Roux <[email protected]>
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
    
    # Conflicts:
    #   birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
    #   birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java
---
 birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java            | 5 ++++-
 birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java | 6 +++++-
 2 files changed, 9 insertions(+), 2 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 0559b95..80a5eed 100644
--- a/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
+++ b/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
@@ -259,7 +259,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 d2735c5..df9dc22 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
@@ -317,7 +317,11 @@ public class BirtServices {
         try {
             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\";>");
+            StringBuffer newForm = new StringBuffer("<?xml version=\"1.0\" 
encoding=\"UTF-8\"?> <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\";>");
             newForm.append(overrideFilters);
             newForm.append("</forms>");
             Document xmlForm = UtilXml.readXmlDocument(newForm.toString());

Reply via email to