Thank you for quick response.
I tried using EdiReaderConfigurator.But it throws weird exception.The same xsd and schemaconfig.xml and input message work fine if I use the code below.
Smooks smooks = new Smooks(new DefaultApplicationContextBuilder().build());
smooks.addResourceConfigs("edi-to-xml/smooks-config.xml");
StringSink sink = new StringSink();
smooks.filterSource(new StreamSource<>(new ByteArrayInputStream(message)), sink);
return sink.getResult();
But fails for :Smooks smooks = new Smooks();
EdiReaderConfigurator ediReaderConfigurator = new EdiReaderConfigurator("edi-to-xml/src/main/resources/edi-to-xml-order-mapping.dfdl.xsd");
ediReaderConfigurator.setDataElementSeparator("*");
ediReaderConfigurator.setSegmentTerminator("~%NL;");
ediReaderConfigurator.setValidationMode(ValidationMode.Full);
smooks.addResourceConfig(ediReaderConfigurator.toConfig().get(0));
StringSink sink = new StringSink();
smooks.filterSource(new StreamSource<>(new ByteArrayInputStream(message)), sink);
Exception::
org.smooks.api.SmooksException: Failed to filter source
at org.smooks.engine.delivery.sax.ng.SaxNgFilter.doFilter(SaxNgFilter.java:123)
at org.smooks.engine.delivery.sax.ng.SaxNgFilter.doFilter(SaxNgFilter.java:97)
at org.smooks.Smooks._filter(Smooks.java:570)
at org.smooks.Smooks.filterSource(Smooks.java:512)
at org.smooks.Smooks.filterSource(Smooks.java:491)
at org.smooks.examples.edi2xml.Main.runSmooksTransform(Main.java:111)
at org.smooks.examples.edi2xml.Main.main(Main.java:132)
Caused by: org.smooks.cartridges.dfdl.parser.ParserDfdlSmooksException: Parse Error: Found enclosing delimiter: '*' during scan for local delimiter(s): 'ISA', '~%NL;'.
The expected delimiter(s) were:
initiator 'ISA' from ISA_InterchangeControlHeader Location line 20 column 22 in C:\repositories\smooks-examples\edi-to-xml\src\main\resources\edi-to-xml-order-mapping.dfdl.xsd.
terminator '~%NL;' from ISA_InterchangeControlHeader Location line 20 column 22 in C:\repositories\smooks-examples\edi-to-xml\src\main\resources\edi-to-xml-order-mapping.dfdl.xsd..
The enclosing delimiter was from sequence[1] Location line 18 column 10 in C:\repositories\smooks-examples\edi-to-xml\src\main\resources\edi-segment-definition.xsd.
Attached sample files.