You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2020/10/04 10:03:47 UTC

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

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

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


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

commit 128c25294283c93f72c1a2fa8975d369a4fe3db6
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Sun Oct 4 12:04:07 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 handled by hand
    #	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            | 3 ++-
 birt/src/main/java/org/apache/ofbiz/birt/flexible/BirtServices.java | 4 +++-
 2 files changed, 5 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 71f0e2b..fd10ea2 100644
--- a/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
+++ b/birt/src/main/java/org/apache/ofbiz/birt/BirtWorker.java
@@ -263,7 +263,8 @@ 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\" xsi:targetNamespace=\"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 5be76c0..c47ff95 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
@@ -311,7 +311,9 @@ 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\" xsi:targetNamespace=\"http://ofbiz.apache.org/dtds/widget-form.xsd\">");
+            
             newForm.append(overrideFilters);
             newForm.append("</forms>");
             Document xmlForm = UtilXml.readXmlDocument(newForm.toString());