/** * Converts XML message to ER7, first checking integrity of parse and throwing * an exception if parse not correct */ static String safeER7Conversion(String xmlMessage) throws HL7Exception { Message m = parser.parse(xmlMessage); String check = parser.encode(m, "XML"); if (!equivalent(xmlMessage, check)) { throw new HL7Exception("Parsed and encoded message not equivalent to original (possibilities: invalid message, bug in parser)"); } return parser.encode(m, "VB"); }
/** * Converts XML message to ER7, first checking integrity of parse and throwing * an exception if parse not correct */ static String safeER7Conversion(String xmlMessage) throws HL7Exception { Message m = parser.parse(xmlMessage); String check = parser.encode(m, "XML"); if (!equivalent(xmlMessage, check)) { throw new HL7Exception("Parsed and encoded message not equivalent to original (possibilities: invalid message, bug in parser)"); } return parser.encode(m, "VB"); }