I need to support multiple versions of v2 messages, so I am using a 
CanonicalModelClassFactory set to version 2.6 to parse all messages as 
described here:
http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/HandlingMultipleVersions.html

My problem now comes when parsing older messages that use WITHDRAWN elements, 
like PID-13, XTN-1.

The HAPI parser throws an exception when it is populated:
ca.uhn.hl7v2.model.DataTypeException: 
ca.uhn.hl7v2.validation.ValidationException: Validation failed: Primitive value 
'5551212' requires to be empty because it is withdrawn from the current HL7 
version and should not be used at PID-13

The message I am parsing in this case does have "2.3" in the MSH-12. So it 
appears the validator is not accounting for the version there.

I can turn validation completely off to work around this:
parser.setValidationContext(new NoValidation());

And I suppose I could manipulate the message prior to parsing it.

But I would prefer a different solution.
Either:
1) Is there is a way to get the validation to "honor" the MSH-12 version for 
the rules it enforces?
Or
2) is there a way to disable specific rules without turning off validation 
entirely?

Thanks!

________________________________

This message is for the designated recipient only and may contain privileged, 
proprietary, or otherwise confidential information. If you have received it in 
error, please notify the sender immediately and delete the original. Any other 
use of the e-mail by you is prohibited. Where allowed by local law, electronic 
communications with Accenture and its affiliates, including e-mail and instant 
messaging (including content), may be scanned by our systems for the purposes 
of information security and assessment of internal compliance with Accenture 
policy.
______________________________________________________________________________________

www.accenture.com
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to