2

I'm using smooks 1.7.1 with mapping model d06a-mapping-1.4 to generate Smooks XML but after that I I would like to revert that operation. Is there any way to use the same mapping model to get Edifact as in input before?

Translating way
EDI --> XML:

Smooks smooks = new Smooks();
smooks.setReaderConfig(new UNEdifactReaderConfigurator("urn:org.milyn.edi.unedifact:d06a-mapping:1.4"));
StringResult result = new StringResult();
InputStream is = new ByteArrayInputStream(file.getBytes(Charset.forName("ISO-8859-2")));
smooks.filterSource(new StreamSource(is), result);
smooks.close();
is.close();
System.out.println(result.getResult());

XML --> EDI
I wastrying to use EDIReaderConfigurator but it result with SAX error

Caused by: org.xml.sax.SAXException: Unknown/Unexpected UN/EDIFACT control block segment code '<en'.

    EDIReaderConfigurator readerConfig = new EDIReaderConfigurator("urn:org.milyn.edi.unedifact:d06a-mapping:*");
    Smooks smooks2 = new Smooks();
    smooks2.setReaderConfig(readerConfig);
    StringResult result2 = new StringResult();
    InputStream is2 = new ByteArrayInputStream(result.getResult().getBytes(Charset.forName("ISO-8859-2")));
    smooks.filterSource(new StreamSource(is2), result2);
    smooks.close();
    is2.close();
    System.out.println(result2.getResult());
Jedrula
  • 21
  • 1

0 Answers0