Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-18664

Target output XML not contain some namespace prefixs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Blocker
    • None
    • fuse-7.10.1-GA
    • Atlas Map
    • None
    • False
    • None
    • False
    • % %
    • Todo
    • Hide
      Turned out the schema is wrong, it needs elementFormDefault="qualified" to propagate the namespace to the sub elements. See https://github.com/atlasmap/atlasmap/pull/3827/files#diff-c1296c525418f30ed1abf29ab30bf99bbbc743be70bd779df58e484ca63b2d89R17
      Show
      Turned out the schema is wrong, it needs elementFormDefault="qualified" to propagate the namespace to the sub elements. See https://github.com/atlasmap/atlasmap/pull/3827/files#diff-c1296c525418f30ed1abf29ab30bf99bbbc743be70bd779df58e484ca63b2d89R17
    • Hide

      Create the .adm map using an xml instance as a target instead of the xsd schema.

      Show
      Create the .adm map using an xml instance as a target instead of the xsd schema.
    • Hide

      To Reproduce
      Execute the unit test by the sample project on github, the unit test with name mappingFromXmlSchemaTest fail
      ````
      mvn clean package
      ````

      With the .adm (atlasmapping-from-xml-schema.adm) the wrong output is:
      ````
      <?xml version="1.0" encoding="UTF-8"?>
      <envelop xmlns="it.redhat.atlasmap.sample/env">
      <customer xmlns="it.redhat.atlasmap.sample/customer">
      <name xmlns="">Mario</name>
      </customer>
      </envelop>
      ````

      Expected behavior
      With the .adm (atlasmapping-from-xml-instance.adm) the right output is:
      ````
      <?xml version="1.0" encoding="UTF-8"?>
      <envelop xmlns:cus="it.redhat.atlasmap.sample/customer">
      <cus:customer>
      <cus:name>Mario</cus:name>
      </cus:customer>
      </envelop>
      ````

      Additional Info
      I unzipped the atlasmapping-from-xml-schema.adm and found that atlasmapping-UI.0.json contain wrong xpath expression for target xml.

      I edited a new atlasmapping-UI.0.json and rezziped in a new atlasmapping-from-xml-schema-mod.adm.zip (just rezziped) modifying:

      from:
      ````
      ...output omit...
      "xmlNamespace" : [

      { "alias" : "cus", "uri" : "it.redhat.atlasmap/customer" }

      ,

      { "alias" : "tns", "uri" : "it.redhat.atlasmap/env" }

      ]
      ...output omit...
      "path" : "/tns:envelop/cus:customer/name",
      ...output omit...
      ````

      to:
      ````
      ...output omit...
      "xmlNamespace" : [

      { "alias" : "cus", "uri" : "it.redhat.atlasmap/customer" }

      ]
      ...output omit...
      "path" : "/envelop/cus:customer/cus:name",
      ...output omit...
      ````

      and the output has correct namespace prefixs but log the following warning
      ````
      [main] WARN io.atlasmap.xml.module.XmlModule - Declaration of the root element ':envelop' was not found in the schema
      ````
       
      Environment

      Atlas UI Version: atlasmap-standalone-2.4.0-M.4.jar
      Atlasmap: Runtime Version: 2.4.0-M.4
      JDK: openjdk version "11.0.2" 2019-01-15
      OS: Macosx

      Show
      To Reproduce Execute the unit test by the  sample project on github , the unit test with name mappingFromXmlSchemaTest fail ```` mvn clean package ```` With the .adm (atlasmapping-from-xml-schema.adm) the wrong output is: ```` <?xml version="1.0" encoding="UTF-8"?> <envelop xmlns="it.redhat.atlasmap.sample/env"> <customer xmlns="it.redhat.atlasmap.sample/customer"> <name xmlns="">Mario</name> </customer> </envelop> ```` Expected behavior With the .adm (atlasmapping-from-xml-instance.adm) the right output is: ```` <?xml version="1.0" encoding="UTF-8"?> <envelop xmlns:cus="it.redhat.atlasmap.sample/customer"> <cus:customer> <cus:name>Mario</cus:name> </cus:customer> </envelop> ```` Additional Info I unzipped the atlasmapping-from-xml-schema.adm and found that atlasmapping-UI.0.json contain wrong xpath expression for target xml. I edited a new atlasmapping-UI.0.json and rezziped in a new  atlasmapping-from-xml-schema-mod.adm.zip  (just rezziped) modifying: from: ```` ...output omit... "xmlNamespace" : [ { "alias" : "cus", "uri" : "it.redhat.atlasmap/customer" } , { "alias" : "tns", "uri" : "it.redhat.atlasmap/env" } ] ...output omit... "path" : "/tns:envelop/cus:customer/name", ...output omit... ```` to: ```` ...output omit... "xmlNamespace" : [ { "alias" : "cus", "uri" : "it.redhat.atlasmap/customer" } ] ...output omit... "path" : "/envelop/cus:customer/cus:name", ...output omit... ```` and the output has correct namespace prefixs but log the following warning ```` [main] WARN io.atlasmap.xml.module.XmlModule - Declaration of the root element ':envelop' was not found in the schema ````   Environment Atlas UI Version: atlasmap-standalone-2.4.0-M.4.jar Atlasmap: Runtime Version: 2.4.0-M.4 JDK: openjdk version "11.0.2" 2019-01-15 OS: Macosx

    Description

      Please refer to public github issue: https://github.com/atlasmap/atlasmap/issues/3826

       

      Describe the bug

      Using a two mappings created with the ui (tested with visual studio) atlasmap-mappings.zip (zip with both .adm files)

      The first mapping produce an xml output without some namespace prefixs.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mronconi@redhat.com Marco Ronconi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: