Subject:EDI/XML question Author:Stanislav Sabol Date:06 Sep 2006 04:50 AM
Hi,
I am trying to find java API for converting EDI to XML and XML to EDI. I found something like this on your webpage : "The Stylus Studio XML Deployment Components consist of the same Java library as the Stylus Studio Java API, but it can be intstalled separately and is governed by a separate license. You can use this API completely independently of Stylus Studio 2006 XML Enterprise Edition". So i want to be sure if it is possible to write Java application using only Stylus Studio XML Deployment Adapters that can convert EDi to XML and XML to EDI? And if there is some Java documentation for Deployment Adapters.
Subject:EDI/XML question Author:Stanislav Sabol Date:07 Sep 2006 05:10 AM Originally Posted: 07 Sep 2006 05:08 AM
thank you,
i successfully converted from EDI to XML and than back but i have one question. My edi file looks like this:
ISA:00: :00: :01:1515151515 :01:5151515151 :041201:1217:U:00403:000032123:0:P:*~GS:CT:9988776655:1122334455:20041201:1217:128:X:004030~ST:831:00128001~BGN:00:88200001:20041201~N9:BT:88200001~TRN:1:88200001~AMT:2:100000.00~QTY:46:1~SE:7:00128001~GE:1:128~IEA:1:000032123~
i convert it to XML and everything is fine ... than i convert this XML file back to EDI and file looks like this:
ISA+00+ +00+ +01+1515151515 +01+5151515151 +041201+1217+U+00403+000032123+0+P+*'GS+CT+9988776655+1122334455+20041201+1217+128+X+004030'ST+831+00128001'BGN+00+88200001+20041201'N9+BT+88200001'TRN+1+88200001'AMT+2+100000.00'QTY+46+1'SE+7+00128001'GE+1+128'IEA+1+000032123'
and the question ... Is there any way hot to get identical file after conversion? ... how to change segment terminator(' to ~) and data element separator (+ to :) in my case...
thanks
my code :
try {
StylusFile in_1 = sff.createStylusFile("adapter:///EDI:decode=no,:field=no?file:C:/Program Files/Stylus Studio 6 XML Enterprise Edition/examples/Adapters/test/831.edi");
File out_1 = new File(path+"test\\output.xml");
InputStream is = in_1.getInputStream();
OutputStream os = new FileOutputStream(out_1);
copy(is, os);
in_1.close();
System.out.println("test 1 succeeded: 831.edi -> output.xml");
} catch (IOException ioe) {
ioe.printStackTrace();
}
try {
File in_2 = new File(path+"/test/output.xml");
StylusFile out_2 = sff.createStylusFile("adapter:///EDI:eol=no?file:C:/Program Files/Stylus Studio 6 XML Enterprise Edition/examples/Adapters/test/xml2Edi831.edi");
InputStream is = new FileInputStream(in_2);
OutputStream os = out_2.getOutputStream();
copy(is, os);
out_2.close();
System.out.println("test 2 succeeded: output.xml -> xml2Edi831.edi");
} catch (IOException ioe) {
ioe.printStackTrace();
}