public static void SerializeTagList(IList <Tag> list, XmlWriter xw) { TagListSerializer.SerializeTagList(list, xw); }
public static byte[] SerializeTagListToJsonBytes(IEnumerable <Tag> list) { return(jsonWriterToBytes(jw => TagListSerializer.SerializeTagList(list, jw))); }
public static void SerializeTagList(IList <Tag> list, JsonWriter jw) { TagListSerializer.SerializeTagList(list, jw); }
public static string SerializeTagListToJson(IList <Tag> list) { return(jsonWriterToString(jw => TagListSerializer.SerializeTagList(list, jw))); }
public static byte[] SerializeTagListToXmlBytes(IEnumerable <Tag> list) { return(xmlWriterToBytes(xw => TagListSerializer.SerializeTagList(list, xw))); }
public static string SerializeTagListToXml(IEnumerable <Tag> list) { return(xmlWriterToString(xw => TagListSerializer.SerializeTagList(list, xw))); }
private static XElement createEntry(BundleEntry entry, bool summary) { XElement result = null; if (entry is ResourceEntry) { ResourceEntry re = (ResourceEntry)entry; result = new XElement(BundleXmlParser.XATOMNS + BundleXmlParser.XATOM_ENTRY); if (!String.IsNullOrEmpty(re.Title)) { result.Add(xmlCreateTitle(re.Title)); } if (Util.UriHasValue(entry.Id)) { result.Add(xmlCreateId(entry.Id)); } if (re.LastUpdated != null) { result.Add(new XElement(BundleXmlParser.XATOMNS + BundleXmlParser.XATOM_UPDATED, re.LastUpdated.Value)); } if (re.Published != null) { result.Add(new XElement(BundleXmlParser.XATOMNS + BundleXmlParser.XATOM_PUBLISHED, re.Published.Value)); } if (!String.IsNullOrWhiteSpace(re.AuthorName)) { result.Add(xmlCreateAuthor(re.AuthorName, re.AuthorUri)); } } else { result = new XElement(BundleXmlParser.XTOMBSTONE + BundleXmlParser.XATOM_DELETED_ENTRY); if (Util.UriHasValue(entry.Id)) { result.Add(new XAttribute(BundleXmlParser.XATOM_DELETED_REF, entry.Id.ToString())); } if (((DeletedEntry)entry).When != null) { result.Add(new XAttribute(BundleXmlParser.XATOM_DELETED_WHEN, ((DeletedEntry)entry).When)); } } if (entry.Links != null) { foreach (var l in entry.Links) { if (l.Uri != null) { result.Add(xmlCreateLink(l.Rel, l.Uri)); } } } if (entry.Tags != null) { foreach (var tag in entry.Tags) { result.Add(TagListSerializer.CreateTagCategoryPropertyXml(tag)); } } if (entry is ResourceEntry) { ResourceEntry re = (ResourceEntry)entry; if (re.Resource != null) { result.Add(new XElement(BundleXmlParser.XATOMNS + BundleXmlParser.XATOM_CONTENT, new XAttribute(BundleXmlParser.XATOM_CONTENT_TYPE, "text/xml"), FhirSerializer.SerializeResourceAsXElement(re.Resource, summary))); } // Note: this is a read-only property, so it is serialized but never parsed if (entry.Summary != null) { result.Add(new XElement(BundleXmlParser.XATOMNS + BundleXmlParser.XATOM_SUMMARY, new XAttribute(BundleXmlParser.XATOM_CONTENT_TYPE, "xhtml"), XElement.Parse(entry.Summary))); } } return(result); }
private static JObject createEntry(BundleEntry entry, bool summary) { JObject result = new JObject(); if (entry is ResourceEntry) { ResourceEntry re = (ResourceEntry)entry; if (!String.IsNullOrEmpty(re.Title)) { result.Add(new JProperty(BundleXmlParser.XATOM_TITLE, re.Title)); } if (Util.UriHasValue(entry.Id)) { result.Add(new JProperty(BundleXmlParser.XATOM_ID, entry.Id.ToString())); } if (re.LastUpdated != null) { result.Add(new JProperty(BundleXmlParser.XATOM_UPDATED, re.LastUpdated)); } if (re.Published != null) { result.Add(new JProperty(BundleXmlParser.XATOM_PUBLISHED, re.Published)); } if (!String.IsNullOrWhiteSpace(re.AuthorName)) { result.Add(jsonCreateAuthor(re.AuthorName, re.AuthorUri)); } } else { DeletedEntry de = (DeletedEntry)entry; if (de.When != null) { result.Add(new JProperty(BundleJsonParser.JATOM_DELETED, de.When)); } if (Util.UriHasValue(entry.Id)) { result.Add(new JProperty(BundleXmlParser.XATOM_ID, entry.Id.ToString())); } } if (entry.Links != null && entry.Links.Count() > 0) { result.Add(new JProperty(BundleXmlParser.XATOM_LINK, jsonCreateLinkArray(entry.Links))); } if (entry.Tags != null && entry.Tags.Count() > 0) { result.Add(TagListSerializer.CreateTagCategoryPropertyJson(entry.Tags)); } if (entry is ResourceEntry) { ResourceEntry re = (ResourceEntry)entry; if (re.Resource != null) { result.Add(new JProperty(BundleXmlParser.XATOM_CONTENT, getContentsAsJObject(re.Resource, summary))); } // Note: this is a read-only property, so it is serialized but never parsed if (entry.Summary != null) { result.Add(new JProperty(BundleXmlParser.XATOM_SUMMARY, entry.Summary)); } } return(result); }