/// <summary> /// Parse ImagingStudySeriesInstanceComponent /// </summary> public static Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent ParseImagingStudySeriesInstanceComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent existingInstance = null) { Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element number else if (atName == "number") { result.NumberElement = IntegerParser.ParseInteger(reader, errors); } // Parse element uid else if (atName == "uid") { result.UidElement = OidParser.ParseOid(reader, errors); } // Parse element sopclass else if (atName == "sopclass") { result.SopclassElement = OidParser.ParseOid(reader, errors); } // Parse element type else if (atName == "type") { result.TypeElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element title else if (atName == "title") { result.TitleElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element url else if (atName == "url") { result.UrlElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element attachment else if (atName == "attachment") { result.Attachment = ResourceReferenceParser.ParseResourceReference(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
public static void SerializeImagingStudySeriesInstanceComponent(Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent value, IFhirWriter writer, bool summary) { writer.WriteStartComplexContent(); // Serialize element _id if (value.LocalIdElement != null) { writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute); } // Serialize element extension if (value.Extension != null && !summary && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element number if (value.NumberElement != null) { writer.WriteStartElement("number"); IntegerSerializer.SerializeInteger(value.NumberElement, writer, summary); writer.WriteEndElement(); } // Serialize element uid if (value.UidElement != null) { writer.WriteStartElement("uid"); OidSerializer.SerializeOid(value.UidElement, writer, summary); writer.WriteEndElement(); } // Serialize element sopclass if (value.SopclassElement != null) { writer.WriteStartElement("sopclass"); OidSerializer.SerializeOid(value.SopclassElement, writer, summary); writer.WriteEndElement(); } // Serialize element type if (value.TypeElement != null) { writer.WriteStartElement("type"); FhirStringSerializer.SerializeFhirString(value.TypeElement, writer, summary); writer.WriteEndElement(); } // Serialize element title if (value.TitleElement != null) { writer.WriteStartElement("title"); FhirStringSerializer.SerializeFhirString(value.TitleElement, writer, summary); writer.WriteEndElement(); } // Serialize element url if (value.UrlElement != null) { writer.WriteStartElement("url"); FhirUriSerializer.SerializeFhirUri(value.UrlElement, writer, summary); writer.WriteEndElement(); } // Serialize element attachment if (value.Attachment != null) { writer.WriteStartElement("attachment"); ResourceReferenceSerializer.SerializeResourceReference(value.Attachment, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); }