Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
[FhirContext.newXmlParser] Potential Parsing Error when parsing previously generated xml/JSON string way back to resource #720
right now we are running first implementational tests using and developing FHIR ressources. Therefore the provided FHIR-HAPI (version 2.5, DTSU3) massivly simplifies necessary work. Thank you.
Based on your documentation we designed a new FHIR-Type "ConsentTemplate" containing a existing FHIR resource "Person" to store contact information. Including this FHIR-Type in a new resource "ImportFormatDefinition" was no problem.
(Resource ImportFormatDefinition-> Type ConsentTemplate-> Person contact)
Parsing it directly in JAVA to XML and/or JSON using FHIR-HAPI, the FHIRcontext and provided ParsingFunctionalities (encodeResourceToString) generated the expected XML/JSON output.
But, parsing this generated and obviuously correct String back to a resource (parseResource) fails , when the string contains Person-Information. A java.lang.ClassCastException occurs in both cases (XML and JSON) when trying to parse the Person-info.
This problem only occurs if the Person-Information is set. Leaving it blank, parsing from resource to xml string and way back is not a problem.
Here is how we are including the Person-Resource into the Datatype
Here is how we are including the datatype in our Resource
Any recommendations or might it be an error in the FHIR-HAPI?
Thanks in advance!
The fact that it's going into
Can you put a breakpoint in the two constructors of ParserState.PreResourceStateHapi and see what is leading it to go there? Given that you are using a DSTU3 structure if should be going into PreResourceStateHl7Org
I made a break point in ParserState.class at Line 1664 and 2259. Parsing of ConsentTemplate-Class goes into PreResourceStateHapi instead of PreResourceStateHl7Org, but it is noticed as DSTU3. (see picture 1). Parsing seems no problem at this point.
A few lines later, when trying to cast the Person.class as IResource (getCurrentElement) the processing fails with the stated exception (see picture 2). Hope this info helps.