-
I'm in the process of implementing a read and write of the 834 transaction using xml. Part of that 834 transaction includes a header section that has 3 loops. 1000A, 1000B and 1000C. They all start with the N1 element. The 1000C loop contains an additional optional element. <l:L0001>
<s:N1>
<e:N101>P5</e:N101>
<e:N102>Paul Peterson</e:N102>
<e:N103>FI</e:N103>
<e:N104>141848746</e:N104>
</s:N1>
</l:L0001>
<l:L0001>
<s:N1>
<e:N101>IN</e:N101>
<e:N102>Oscar Insurance Company</e:N102>
<e:N103>94</e:N103>
<e:N104>473185443</e:N104>
</s:N1>
</l:L0001> I was expecting to see something like this: <l:Loop1000A>
<s:N1>
<e:N101>P5</e:N101>
<e:N102>Paul Peterson</e:N102>
<e:N103>FI</e:N103>
<e:N104>141848746</e:N104>
</s:N1>
</l:Loop1000A>
<l:Loop1000B>
<s:N1>
<e:N101>IN</e:N101>
<e:N102>Oscar Insurance Company</e:N102>
<e:N103>94</e:N103>
<e:N104>473185443</e:N104>
</s:N1>
</l:Loop1000B> Is my expectation wrong, or have I cross wired something? Am I missing a hook somewhere? I've attached the transaction, implementation and types xml files. And a code snippet how I'm using the schema and generating the xml based on the edi payload. schema.zip ClassLoader classLoader = getClass().getClassLoader();
SchemaFactory schemaFactory;
Schema schema;
schemaFactory = SchemaFactory.newFactory();
InputStream inputStream = classLoader.getResourceAsStream("schema/834Impl.xml");
schema = schemaFactory.createSchema(inputStream);
EDIInputFactory factory = EDIInputFactory.newFactory();
ByteArrayInputStream stream = new ByteArrayInputStream((
"ISA*00* *00* *ZZ*ABCDEFGHIJK *ZZ*473185443 *220509*1558*^*00501*100000259*0*T*:~"
+ "GS*BE*ABCDEFGHIJK*473185443*20220509*1558*1259*X*005010X220A1~"
+ "ST*834*1000*005010X220A1~"
+ "BGN*00*134267363*20220509*1558*MT***2~"
+ "REF*38*ABCDEFGHI~"
+ "DTP*303*D8*20220509~"
+ "QTY*TO*1~"
+ "QTY*DT*0~"
+ "QTY*ET*1~"
+ "N1*P5*Paul Peterson*FI*141848746~"
+ "N1*IN*Oscar Insurance Company*94*473185443~"
+ "N1*TV*Paul Peterson*FI*141848746~"
+ "ACT*1234*****23498765~"
+ "SE*65*1015~"
+ "GE*16*1259~"
+ "IEA*1*100000259~").getBytes());
EDIStreamReader ediReader;
ediReader = factory.createEDIStreamReader(stream);
ediReader = factory.createFilteredReader(ediReader, (reader) -> {
if (reader.getEventType() == EDIStreamEvent.START_TRANSACTION) {
reader.setTransactionSchema(schema);
}
return true;
});
XMLStreamReader xmlReader = factory.createXMLStreamReader(ediReader);
xmlReader.next(); // Per StAXSource JavaDoc, put in START_DOCUMENT state
TransformerFactory xformFactory = TransformerFactory.newInstance();
Transformer transformer = xformFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
StringWriter result = new StringWriter();
transformer.transform(new StAXSource(xmlReader), new StreamResult(result));
String ediToXmlString = result.toString();
System.out.println("Generated 834XML:");
System.out.println(ediToXmlString); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@d-floyd your expectation is correct, I'm looking into this. Can you please confirm you're using the latest version of staedi? I get the correct output using your schema and code: <?xml version="1.0" encoding="UTF-8"?>
<l:INTERCHANGE xmlns:l="urn:xlate.io:staedi:names:loops" xmlns:s="urn:xlate.io:staedi:names:segments" xmlns:c="urn:xlate.io:staedi:names:composites" xmlns:e="urn:xlate.io:staedi:names:elements">
<s:ISA>
<e:ISA01>00</e:ISA01>
<e:ISA02> </e:ISA02>
<e:ISA03>00</e:ISA03>
<e:ISA04> </e:ISA04>
<e:ISA05>ZZ</e:ISA05>
<e:ISA06>ABCDEFGHIJK </e:ISA06>
<e:ISA07>ZZ</e:ISA07>
<e:ISA08>473185443 </e:ISA08>
<e:ISA09>220509</e:ISA09>
<e:ISA10>1558</e:ISA10>
<e:ISA11>^</e:ISA11>
<e:ISA12>00501</e:ISA12>
<e:ISA13>100000259</e:ISA13>
<e:ISA14>0</e:ISA14>
<e:ISA15>T</e:ISA15>
<e:ISA16>:</e:ISA16>
</s:ISA>
<l:GROUP>
<s:GS>
<e:GS01>BE</e:GS01>
<e:GS02>ABCDEFGHIJK</e:GS02>
<e:GS03>473185443</e:GS03>
<e:GS04>20220509</e:GS04>
<e:GS05>1558</e:GS05>
<e:GS06>1259</e:GS06>
<e:GS07>X</e:GS07>
<e:GS08>005010X220A1</e:GS08>
</s:GS>
<l:TRANSACTION>
<s:ST>
<e:ST01>834</e:ST01>
<e:ST02>1000</e:ST02>
<e:ST03>005010X220A1</e:ST03>
</s:ST>
<s:BGN>
<e:BGN01>00</e:BGN01>
<e:BGN02>134267363</e:BGN02>
<e:BGN03>20220509</e:BGN03>
<e:BGN04>1558</e:BGN04>
<e:BGN05>MT</e:BGN05>
<e:BGN06/>
<e:BGN07/>
<e:BGN08>2</e:BGN08>
</s:BGN>
<s:REF>
<e:REF01>38</e:REF01>
<e:REF02>ABCDEFGHI</e:REF02>
</s:REF>
<s:DTP>
<e:DTP01>303</e:DTP01>
<e:DTP02>D8</e:DTP02>
<e:DTP03>20220509</e:DTP03>
</s:DTP>
<s:QTY>
<e:QTY01>TO</e:QTY01>
<e:QTY02>1</e:QTY02>
</s:QTY>
<s:QTY>
<e:QTY01>DT</e:QTY01>
<e:QTY02>0</e:QTY02>
</s:QTY>
<s:QTY>
<e:QTY01>ET</e:QTY01>
<e:QTY02>1</e:QTY02>
</s:QTY>
<l:Loop1000A>
<s:N1>
<e:N101>P5</e:N101>
<e:N102>Paul Peterson</e:N102>
<e:N103>FI</e:N103>
<e:N104>141848746</e:N104>
</s:N1>
</l:Loop1000A>
<l:Loop1000B>
<s:N1>
<e:N101>IN</e:N101>
<e:N102>Oscar Insurance Company</e:N102>
<e:N103>94</e:N103>
<e:N104>473185443</e:N104>
</s:N1>
</l:Loop1000B>
<l:Loop1000C>
<s:N1>
<e:N101>TV</e:N101>
<e:N102>Paul Peterson</e:N102>
<e:N103>FI</e:N103>
<e:N104>141848746</e:N104>
</s:N1>
<l:Loop1100C>
<s:ACT>
<e:ACT01>1234</e:ACT01>
<e:ACT02/>
<e:ACT03/>
<e:ACT04/>
<e:ACT05/>
<e:ACT06>23498765</e:ACT06>
</s:ACT>
</l:Loop1100C>
</l:Loop1000C>
<s:SE>
<e:SE01>65</e:SE01>
<e:SE02>1015</e:SE02>
</s:SE>
</l:TRANSACTION>
<s:GE>
<e:GE01>16</e:GE01>
<e:GE02>1259</e:GE02>
</s:GE>
</l:GROUP>
<s:IEA>
<e:IEA01>1</e:IEA01>
<e:IEA02>100000259</e:IEA02>
</s:IEA>
</l:INTERCHANGE> |
Beta Was this translation helpful? Give feedback.
-
Upgraded to 1.20.0. Problem solvded. |
Beta Was this translation helpful? Give feedback.
Upgraded to 1.20.0. Problem solvded.