【问题标题】:Hapi encoding HL7 v2.7 message into xml using Hapi XML Parser使用 Hapi XML Parser 将 HL7 v2.7 消息编码为 xml
【发布时间】:2018-01-25 13:22:26
【问题描述】:

Hapi xml 解析器在使用 Hapi Xml 解析器对 HL7 v2.7 消息进行编码时出现以下异常。

ca.uhn.hl7v2.HL7Exception:无法对 GenericMessage 进行 XML 编码。信息 必须具有公认的结构。

下面是我用来编码消息的代码 sn-p

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); 

有什么建议/解决方案吗?

【问题讨论】:

  • 我用 hl7-v2 标记它...希望有人可以帮助您...

标签: java xml-parsing hapi hl7-v2


【解决方案1】:

如果您尝试编码的消息没有特定类型而是GenericMessage,则会引发此异常。似乎 HAPI 无法为您的document 确定正确的消息类型。如果将 HAPI 的日志级别提高到 DEBUG,它可能会给您一个线索,为什么 PipeParser 无法创建特定消息类型的实例。

【讨论】:

    猜你喜欢
    • 2011-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多