public static void SerializeQuestionnaire(Hl7.Fhir.Model.Questionnaire value, IFhirWriter writer, bool summary) { writer.WriteStartRootObject("Questionnaire"); 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 language if (value.LanguageElement != null && !summary) { writer.WriteStartElement("language"); CodeSerializer.SerializeCode(value.LanguageElement, writer, summary); writer.WriteEndElement(); } // Serialize element text if (value.Text != null && !summary) { writer.WriteStartElement("text"); NarrativeSerializer.SerializeNarrative(value.Text, writer, summary); writer.WriteEndElement(); } // Serialize element contained if (value.Contained != null && !summary && value.Contained.Count > 0) { writer.WriteStartArrayElement("contained"); foreach (var item in value.Contained) { writer.WriteStartArrayMember("contained"); FhirSerializer.SerializeResource(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element status if (value.StatusElement != null) { writer.WriteStartElement("status"); CodeSerializer.SerializeCode <Hl7.Fhir.Model.ObservationStatus>(value.StatusElement, writer, summary); writer.WriteEndElement(); } // Serialize element authored if (value.AuthoredElement != null) { writer.WriteStartElement("authored"); FhirDateTimeSerializer.SerializeFhirDateTime(value.AuthoredElement, writer, summary); writer.WriteEndElement(); } // Serialize element subject if (value.Subject != null) { writer.WriteStartElement("subject"); ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary); writer.WriteEndElement(); } // Serialize element author if (value.Author != null) { writer.WriteStartElement("author"); ResourceReferenceSerializer.SerializeResourceReference(value.Author, writer, summary); writer.WriteEndElement(); } // Serialize element source if (value.Source != null) { writer.WriteStartElement("source"); ResourceReferenceSerializer.SerializeResourceReference(value.Source, writer, summary); writer.WriteEndElement(); } // Serialize element name if (value.Name != null) { writer.WriteStartElement("name"); CodeableConceptSerializer.SerializeCodeableConcept(value.Name, writer, summary); writer.WriteEndElement(); } // Serialize element identifier if (value.Identifier != null) { writer.WriteStartElement("identifier"); IdentifierSerializer.SerializeIdentifier(value.Identifier, writer, summary); writer.WriteEndElement(); } // Serialize element encounter if (value.Encounter != null) { writer.WriteStartElement("encounter"); ResourceReferenceSerializer.SerializeResourceReference(value.Encounter, writer, summary); writer.WriteEndElement(); } // Serialize element question if (value.Question != null && !summary && value.Question.Count > 0) { writer.WriteStartArrayElement("question"); foreach (var item in value.Question) { writer.WriteStartArrayMember("question"); QuestionnaireSerializer.SerializeQuestionComponent(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element group if (value.Group != null && !summary && value.Group.Count > 0) { writer.WriteStartArrayElement("group"); foreach (var item in value.Group) { writer.WriteStartArrayMember("group"); QuestionnaireSerializer.SerializeGroupComponent(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
public static void SerializeGroupComponent(Hl7.Fhir.Model.Questionnaire.GroupComponent 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 name if (value.Name != null) { writer.WriteStartElement("name"); CodeableConceptSerializer.SerializeCodeableConcept(value.Name, writer, summary); writer.WriteEndElement(); } // Serialize element header if (value.HeaderElement != null) { writer.WriteStartElement("header"); FhirStringSerializer.SerializeFhirString(value.HeaderElement, writer, summary); writer.WriteEndElement(); } // Serialize element text if (value.TextElement != null) { writer.WriteStartElement("text"); FhirStringSerializer.SerializeFhirString(value.TextElement, writer, summary); writer.WriteEndElement(); } // Serialize element subject if (value.Subject != null) { writer.WriteStartElement("subject"); ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary); writer.WriteEndElement(); } // Serialize element question if (value.Question != null && value.Question.Count > 0) { writer.WriteStartArrayElement("question"); foreach (var item in value.Question) { writer.WriteStartArrayMember("question"); QuestionnaireSerializer.SerializeQuestionComponent(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element group if (value.Group != null && value.Group.Count > 0) { writer.WriteStartArrayElement("group"); foreach (var item in value.Group) { writer.WriteStartArrayMember("group"); QuestionnaireSerializer.SerializeGroupComponent(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } writer.WriteEndComplexContent(); }