From: Tripp, B. <Bry...@uh...> - 2003-05-23 21:03:18
|
Hi Rob, Apologies for this -- it's a bug that was fixed in October, but we haven't done a release since then. You can pick up the fix from the CVS. Hope to get version 0.4 out soon. Bryan -----Original Message----- From: Rob Summitt [mailto:ro...@bl...] Sent: May 23, 2003 1:42 AM To: hl7...@li... Subject: [HAPI-devel] error I'm getting serialization errors when I attempt to run the ParserDemo.java example. Outputting status messages to standard out. ca.uhn.hl7v2.util.Status: Standard status messages will be output. 23/21/2003 1:38:9.437 Parsing msg of class ca.uhn.hl7v2.model.v24.message.ACK 23/21/2003 1:38:9.984 Setting current log date to May 23, 2003 FileLog: logging exception ca.uhn.hl7v2.HL7Exception: IOException serializing XML document to string: at ca.uhn.hl7v2.parser.XMLParser.encode(XMLParser.java:182) at ParserDemo.main(ParserDemo.java:30) Here is the source.. import ca.uhn.hl7v2.parser.*; import ca.uhn.hl7v2.model.Message; import ca.uhn.hl7v2.model.v24.message.ACK; public class ParserDemo { public static void main(String args[]) { //for demo purposes, we just declare a literal message string String ackMessageString = "MSH|^~\\&|foo|foo||foo|200108151718||ACK^A01^ACK|1|D|2.4|\rMSA|AA\r"; //instantiate a PipeParser, which handles the "traditional encoding" PipeParser pipeParser = new PipeParser(); try { //parse the message string into a Message object Message message = pipeParser.parse(ackMessageString); //if it is an ACK message (as we know it is), cast it to an // ACK object so that it is easier to work with, and change a value if (message instanceof ACK) { ACK ack = (ACK) message; ack.getMSH().getProcessingID().getProcessingMode().setValue("P"); } //instantiate an XML parser XMLParser xmlParser = new DefaultXMLParser(); //encode message in XML String ackMessageInXML = xmlParser.encode(message); //print XML-encoded message to standard out System.out.println(ackMessageInXML); } catch (Exception e) { e.printStackTrace(); } } } Thanks for any help. Rob ro...@bl... <mailto:ro...@bl...> This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Opinions, conclusions or other information contained in this e-mail may not be that of the organization. |