Thanks Ian, Yep, that snippet works fine with v2.3. I will update with some more examples of the HL7 and the corresponding XML I seek.
On Thu, Oct 30, 2014 at 3:56 PM, Chandan Datta <chandan.da...@auckland.ac.nz > wrote: > Hi Ian, > > I want to just transform a HL7 segment to a XML. Is it possible to disable > the validation in the parser for that and create a XML representation out > of it? > > On Thu, Oct 30, 2014 at 3:11 PM, Ian Vowles <ian.vow...@health.qld.gov.au> > wrote: > >> Here is a snippet of code which is in use here: >> >> >> >> HapiContext hapiContext = new DefaultHapiContext(); >> >> hapiContext.setModelClassFactory(new >> CanonicalModelClassFactory(hl7Version)); >> >> hapiContext.setValidationRuleBuilder(new NoValidationBuilder()); >> >> >> >> final PipeParser pipeParser = hapiContext.getPipeParser(); >> >> final Message hapiMessage = pipeParser.parse(message); >> >> >> >> hapi library version 2.2 >> >> >> >> hl7Version is a string describing the hl7Version to use (we usually set >> it to “2.4”, you could set it to “2.3”, or you could use a default model >> class factory and let the pipe parser find the Hl7 version from the MSH). >> >> message is a string containing the hl7 message. >> >> >> >> Hope this helps >> >> >> >> Ian >> >> >> >> Systems Integration Team >> >> Qld Dept of Health >> >> Australia >> >> >> >> *From:* Chandan Datta [mailto:chandan.da...@auckland.ac.nz] >> *Sent:* Thursday, 30 October 2014 10:11 AM >> *To:* hl7api-devel@lists.sourceforge.net >> *Subject:* [HAPI-devel] Parse HL7 v2.3 REF message with local >> customizations >> >> >> >> Hi all, >> >> >> >> I am trying parse a HL7 REF I12 message with local customization(NZ). >> When I tried using the GenericParser, I keep getting Validation exceptions. >> >> >> >> For example for the segment below, I keep get the output >> ca.uhn.hl7v2.validation.ValidationException: >> Validation failed: Primitive value '(08)569-7555' requires to be empty or a >> US phone number >> >> >> >> PRD|PP|See T Tan^""^""^^""|""^^^^""^New Zealand||(08)569-7555||14134^NZMC >> >> >> >> My question is: >> >> - Is there a way to avoid the validation by using the conformance >> class generator >> - Is it possible to create own validation classes using >> CustomModelClasses? >> >> >> >> In either case, is there any example code for that or tutorial example >> documentation? >> >> >> >> -- >> >> Regards, >> Chandan >> Doctoral student,Robotics Research Group >> University of Auckland, New Zealand >> >> >> >> >> >> >> ******************************************************************************** >> >> This email, including any attachments sent with it, is confidential and >> for the sole use of the intended recipient(s). This confidentiality is not >> waived or lost, if you receive it and you are not the intended >> recipient(s), or if it is transmitted/received in error. >> >> Any unauthorised use, alteration, disclosure, distribution or review of >> this email is strictly prohibited. The information contained in this email, >> including any attachment sent with it, may be subject to a statutory duty >> of confidentiality if it relates to health service matters. >> >> If you are not the intended recipient(s), or if you have received this >> email in error, you are asked to immediately notify the sender by telephone >> collect on Australia +61 1800 198 175 or by return email. You should >> also delete this email, and any copies, from your computer system network >> and destroy any hard copies produced. >> >> If not an intended recipient of this email, you must not copy, distribute >> or take any action(s) that relies on it; any form of disclosure, >> modification, distribution and/or publication of this email is also >> prohibited. >> >> Although Queensland Health takes all reasonable steps to ensure this >> email does not contain malicious software, Queensland Health does not >> accept responsibility for the consequences if any person's computer >> inadvertently suffers any disruption to services, loss of information, harm >> or is infected with a virus, other malicious computer programme or code >> that may occur as a consequence of receiving this email. >> >> Unless stated otherwise, this email represents only the views of the >> sender and not the views of the Queensland Government. >> >> >> ********************************************************************************** >> >> >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> Hl7api-devel mailing list >> Hl7api-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/hl7api-devel >> >> > > > -- > Regards, > Chandan > Doctoral student,Robotics Research Group > University of Auckland, New Zealand > -- Regards, Chandan
------------------------------------------------------------------------------
_______________________________________________ Hl7api-devel mailing list Hl7api-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hl7api-devel