Mohamed Mseddi
Mohamed Mseddi

Reputation: 5

How to convert a json to EDIFACT using smooks with java

The only way I found is edi not edifact but when i change the smooks-config.xml with edifact

<smooks-resource-list
    xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd"
    xmlns:edifact="https://www.smooks.org/xsd/smooks/edifact-2.0.xsd">

<edifact:unparser   unparseOnElement="/Order" schemaURI="/edi-to-xml-mapping.dfdl.xsd" segmentTerminator="%NL;" compositeDataElementSeparator="^"/>

<edifact:parser schemaURI="/edi-to-xml-order-mapping.dfdl.xsd" segmentTerminator="%NL;" dataElementSeparator="*"
                compositeDataElementSeparator="^"/>

I always get an error : Schema Definition Error: No schema document at location /EDIFACT-Interchange.dfdl.xsd.

Upvotes: -1

Views: 1252

Answers (1)

Claude
Claude

Reputation: 524

As described in the Smooks EDI cartridge docs, the EDIFACT-Messages.dfdl.xsd DFDL schema should be imported. For example:

<?xml version="1.0"?>
<smooks-resource-list xmlns="https://www.smooks.org/xsd/smooks-2.0.xsd"
                      xmlns:edifact="https://www.smooks.org/xsd/smooks/edifact-2.0.xsd">

    <edifact:parser schemaURI="/d03b/EDIFACT-Messages.dfdl.xsd"/>

    <edifact:unparser schemaURI="/d03b/EDIFACT-Messages.dfdl.xsd" unparseOnNode="/Interchange"/>

</smooks-resource-list>

Ensure that the corresponding schema pack is in your Java classpath. The schema pack Maven dependency declaration for the above example is:

<dependency>
  <groupId>org.smooks.cartridges.edi</groupId>
  <artifactId>edifact-schemas</artifactId>
  <version>2.0.0-M3</version>
  <classifier>d03b</classifier>
</dependency>

Upvotes: 1

Related Questions