private static Resource getContents(JToken token, ErrorList errors) { //TODO: This is quite inefficient. The Json parser has just parsed this //entry's Resource from json, now we are going to serialize it to as string //just to read from it again using a JsonTextReader. But that is what my //parser takes as input, so no choice for now... //Maybe: JsonTextReader r = token.CreateReader(); is a way out? string contents = token.ToString(); JsonTextReader r = new JsonTextReader(new StringReader(contents)); return(FhirParser.ParseResource(new JsonFhirReader(r), errors)); }
public static Resource ParseContainedResource(IFhirReader reader, ErrorList errors) { Resource result = null; // Read into "contained" element reader.EnterElement(); result = FhirParser.ParseResource(reader, errors); // Exit from "contained" element reader.LeaveElement(); return(result); }