Hapi xml パーサーを使用して HL7 v2.7 メッセージをエンコードしているときに、Hapi xml パーサーが次の例外を発生させます。
ca.uhn.hl7v2.HL7Exception: GenericMessage を XML エンコードできません。メッセージには、認識された構造が必要です。
以下は、メッセージをエンコードするために使用しているコード スニペットです。
HapiContext context = new DefaultHapiContext(modelClassFactory)
PipeParser pipeParser = context.getPipeParser();
pipeParser.setValidationContext(new NoValidation());
pipeParser.getParserConfiguration().setAllowUnknownVersions(true);
Message msg = pipeParser.parse(document);
Parser xmlParser = context.getXMLParser();
return xmlParser.encode(msg);
提案/解決策はありますか?