From: Metz, S. <Ste...@cc...> - 2014-02-10 19:55:38
|
Hi everyone, I'm brand new to HAPI and Java, as well, so thanks in advance for your patience. I'm trying to write a Java class which accepts HL7 data which has already been converted to XML. I want to validate the XML against a conformance file, or, preferably against a default HL7 HAPI schema, if there is such a thing. Is there an example of how to do this? I've been looking at ca.uhn.hl7v2.validation.Validator because the validate method seems to allow you to specify that the input message is in XML format. My try/catch is below. The thing is, no matter what I set variable hapiString to, it returns true. Obviously I'm doing something wrong. try { Boolean valid = false; Validator<Object> validator = new DefaultValidator<Object>(hapiContext); valid = (Boolean) validator.validate(hapiString, true, hver); System.out.println("Validation outcome: " + valid); } catch (Exception exc) { exc.printStackTrace(); } Thanks very much, Steve |