Hi team,
We created a custom dfdl transformation for an edifact file. Our dfdl schema has one import: IBM_EDI_Format.xsd.
We have tested it with Daffodil 3.1.0 and it works well both ways, it parses and unparses the edi file to/from our desired XML format. So far so good.
Now we are trying to run it from Smooks, so we are looking at repo:
https://github.com/smooks/smooks-examples (tag v1.0.1)
First we tried examples edi-to-xml and edifact-to-xml, and both work well.
However, when trying to run our own dfdl, by modifying any of these 2 examples, we can't make it work (neither with edi-to-xml nor with edifact-to-xml).
Case: edi-to-xmlWe replace input-message.edi, copied the new schema and IBM_EDI_Format.xsd to src/main/resources
Updated smooks-config.xml like this
<edi:parser schemaURI="/edifact-d93a-ifcsum-schema-v1.0.0.dfdl.xsd" />
We get this error:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project smooks-example-edi-to-xml:
An exception occured while executing the Java class.
Error invoking @PostConstruct method 'initialize' on class 'org.smooks.cartridges.dfdl.parser.DfdlParser'.:
java.lang.RuntimeException: Schema Definition Error: Cannot set variable ibmEdiFmt:CompositeSep externally.
State was: VariableDefined. Existing value: DataValue(:).
If I comment the variable declaration in IBM_EDI_Format.xsd
<!-- <dfdl:defineVariable defaultValue="'%WSP*; %NL;%WSP*;" name="SegmentTerm" type="xsd:string"/>
<dfdl:defineVariable defaultValue="+" name="FieldSep" type="xsd:string"/>
<dfdl:defineVariable defaultValue=":" name="CompositeSep" type="xsd:string"/>
<dfdl:defineVariable defaultValue="?" name="EscapeChar" type="xsd:string"/>
<dfdl:defineVariable defaultValue="*" name="RepeatSep" type="xsd:string"/>
<dfdl:defineVariable defaultValue="." name="DecimalSep" type="xsd:string"/>
<dfdl:defineVariable defaultValue="," name="GroupingSep" type="xsd:string"/> -->
then it complains that the variable is not defined:
Error invoking @PostConstruct method 'initialize' on class 'org.smooks.cartridges.dfdl.parser.DfdlParser'.: java.lang.RuntimeException: Schema Definition Error: Undefined variable: $ibmEdiFmt:EscapeChar
Case: edifact to xmlAfter updating the Main class java code and smooks-config.xml
<edifact:parser schemaURI="edifact-d93a-ifcsum-schema-v1.0.0.dfdl.xsd">
<edifact:messageTypes>
<edifact:messageType>IFCSUM</edifact:messageType>
</edifact:messageTypes>
</edifact:parser>
We get error:
An exception occured while executing the Java class. Error invoking @PostConstruct method 'initialize' on class 'org.smooks.cartridges.dfdl.parser.DfdlParser'.: org.smooks.cdr.SmooksConfigurationException: java.lang.RuntimeException: Schema Definition Error: Error loading schema due to org.xml.sax.SAXParseException; systemId: file:/tmp/267592235106779405/EDIFACT-Interchange-6654ae4a-a2c2-3a29-af11-a4162566510f-.dfdl.xsd; lineNumber: 25; columnNumber: 15; name cannot end in ':'
[ERROR] Schema context: file:/tmp/267592235106779405/EDIFACT-Interchange-6654ae4a-a2c2-3a29-af11-a4162566510f-.dfdl.xsd Location in file:/tmp/267592235106779405/EDIFACT-Interchange-6654ae4a-a2c2-3a29-af11-a4162566510f-.dfdl.xsd
Could you please give us some advice on how to run our custom dfdl transform from Smooks? I assume we are doing something wrong when loading our schema (or its imports and variables), since we get initialization errors.
Thanks