* Serialize HL7 message to XML
* @param rowHL7
* @return XML String
*/
private String serializeHL7toXML(String rowHL7) {
Parser xmlParser = new DefaultXMLParser();
Parser ediParser = new PipeParser();
ediParser.setValidationContext(new NoValidation());
String xmlDoc = null;
try {
Message message = ediParser.parse(rowHL7);
ConformanceProfileRule rule = new ConformanceProfileRule();
ValidationException[] exs = rule.test(message);
if (exs != null && exs.length > 0) {
throw new HL7Exception(exs[0].getMessage());
}
if(log.isDebugEnabled()){
log.debug("HL7 parsing completed." + message);
}
xmlDoc = xmlParser.encode(message);
} catch (HL7Exception e) {
handleException("Error on converting to HL7",e);
}
return xmlDoc;
}