使用 HL7.FHIR.STU3.Core,当我尝试解析 PlanDefinition FHIR 文件时,我收到了无效的强制转换异常。
我是否需要为 PlanDefinition 文件设置架构?
string HL7FilePath = string.Format("{0}\\{1}", System.IO.Directory.GetCurrentDirectory(), "ANA3.xml");
string HL7FileData = File.ReadAllText(HL7FilePath)
var b = new FhirXmlParser().Parse<Bundle>(HL7FileData);
错误
InValidCastException {"Unable to cast object of type 'Hl7.Fhir.Model.PlanDefinition' to type 'Hl7.Fhir.Model.Bundle'."}
正如 InvalidCastException 告诉您的那样,您正在尝试将 PlanDefinition 资源解析为 Bundle 对象。如果您将其更改Parse<Bundle>
为Parse<PlanDefinition>
您的代码应该可以正常工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句