From: Russell B. <ru...@wi...> - 2020-04-06 18:10:10
|
I wonder if there's a way to get an XPath within the source document for any, given piece of information I'm able to get out of the API. (Note that there is a way to do this using MDHT for HL7 v3 work; this is why I ask.) I need to annotate data I extract with the location where I found it in the original source document. For example, let's assume the following code: FhirContext context = FhirContext.forDstu3(); IParser parser = context.newXmlParser(); Patient patient = parser.parseResource( Patient.class, getFhirRecord() ); List< HumanName > names = patient.getName(); for( HumanName name : names ) { String family = name.getFamily(); List< StringType > givenNames = name.getGiven(); for( StringType given : givenNames ) { String name = given.toString(); String xpath = ?; // x marks the spot } } Neither by inspecting data structures in the debugger nor by examining the Javadoc for /org.hl7.fhir.dstu3.model.Patient/ am I able to find way to get back something like /Patient/contained[1]/Patient/name/given[1]/ for a given name at [x marks the spot above] . How are others solving this? Does anyone else need to solve this? Thanks |