/*
* In a real situation, of course, many more segments and fields would be populated
*/
// Now, let's encode the message and look at the output
Parser parser = new PipeParser();
String encodedMessage = parser.encode(adt);
System.out.println("Printing ER7 Encoded Message:");
System.out.println(encodedMessage);
/*
* Prints:
*
* MSH|^~\&|TestSendingSystem||||200701011539||ADT^A01^ADT A01||||123
* PID|||123456||Doe^John
*/
// Next, let's use the XML parser to encode as XML
parser = new DefaultXMLParser();
encodedMessage = parser.encode(adt);
System.out.println("Printing XML Encoded Message:");
System.out.println(encodedMessage);
/*
* Prints: