■ HIPAA and X12 use the TA1 interchange to indicate whether a transmission was accepted, accepted with errors, or rejected. The 997 or 999 transaction sets, as set by the xr=URI property, are used to report errors encountered during EDI processing.As described in “Response Element”, the analyze method generates dialect-specific transmission responses as Receipt and Acknowledgement elements in the EDI analysis report.Here is an example of the Receipt element from the analysis report created using the analyze method to convert the sample file threemsgs.x12 to XML:Following is an example of the Acknowledgement element from the same analysis report created using the analyze method to convert the sample file threemsgs.x12 to XML. Note that is has been abbreviated for formatting considerations.
■ The TS_997 element serves as a message wrapper for transaction messages. The TS represents transaction set, and 997 indicates the type of message.
■ Use the analyze method to generate the analysis report and convert the EDI data stream (in this case, a sample X12 EDI document, threemsgs.x12) to XML.To see a complete example application that converts both Receipt and Acknowledgement responses to EDI, see “Example 14”.Invoking the analyze MethodNext, the analyze method is used to generate the analysis report and save the output to report.xml:See “Receipt Element Example” for a sample of the analysis report, report.xml.The analysis report is used as input to convert the EDI stream to XML. Any errors in the EDI stream are recorded in the analysis report, which is used by ConvertToXML as a filter so that only valid EDI messages are converted to XML. Here, the valid EDI is written to an XML document, twomsgs.xml.Once the XMLStreamReader object is created, we can read through the analysis report, skipping first to the Receipt element, then to the X12 element:This simple XQuery locates the Interchange Control Header (ISA) segment, replaces the value of the Interchange Control Number (ISA12) segment with 1000, and converts the node to EDI for transmission to the EDI sender.