public void SetBody(TagList tagList, ResourceFormat format) { if (tagList == null) throw Error.ArgumentNull("tagList"); _body = format == ResourceFormat.Xml ? FhirSerializer.SerializeTagListToXmlBytes(tagList) : FhirSerializer.SerializeTagListToJsonBytes(tagList); _contentType = ContentType.BuildContentType(format, forBundle: false); }
public void TestUseFhirParserToTagList() { TagList l = new TagList(); l.Category = new List<Tag>(); l.Category.Add(new Tag("http://www.nu.nl/tags", Tag.FHIRTAGSCHEME_GENERAL, "No!")); l.Category.Add(new Tag("http://www.furore.com/tags", Tag.FHIRTAGSCHEME_GENERAL, "Maybe, indeed")); var xml = FhirSerializer.SerializeToXml(l); Assert.AreEqual(xmlTagList, xml); }
public HttpResponseMessage DeleteTags(string type, string id, TagList taglist) { service.RemoveTags(type, id, taglist != null ? taglist.Category : null); return Request.CreateResponse(HttpStatusCode.NoContent); }
public HttpResponseMessage AffixTag(string type, string id, string vid, TagList taglist) { service.AffixTags(type, id, vid, taglist != null ? taglist.Category : null); return Request.CreateResponse(HttpStatusCode.OK); }
public static void SerializeTagList(TagList list, XmlWriter xw) { FhirSerializer.Serialize(list, new XmlFhirWriter(xw), false); }
public static void SerializeTagList(TagList list, JsonWriter jw) { FhirSerializer.Serialize(list, new JsonDomFhirWriter(jw), false); }
public static byte[] SerializeTagListToJsonBytes(TagList list) { return SerializeToJsonBytes(list, false); }
public static string SerializeTagListToJson(TagList list) { return SerializeToJson(list,false); }
public void SerializeAndDeserializeTagList() { TagList tl = new TagList(); tl.Category.Add(new Tag("http://www.nu.nl/tags", Tag.FHIRTAGSCHEME_GENERAL, "No!")); tl.Category.Add(new Tag("http://www.furore.com/tags", Tag.FHIRTAGSCHEME_GENERAL, "Maybe, indeed" )); string json = FhirSerializer.SerializeTagListToJson(tl); Assert.AreEqual(jsonTagList, json); string xml = FhirSerializer.SerializeTagListToXml(tl); Assert.AreEqual(xmlTagList, xml); tl = FhirParser.ParseTagListFromXml(xml); verifyTagList(tl.Category); tl = FhirParser.ParseTagListFromJson(json); verifyTagList(tl.Category); }