/// <summary> /// Parse ResourceReference /// </summary> public static Hl7.Fhir.Model.ResourceReference ParseResourceReference(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ResourceReference existingInstance = null) { Hl7.Fhir.Model.ResourceReference result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ResourceReference(); 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 type else if (atName == "type") { result.TypeElement = CodeParser.ParseCode(reader, errors); } // Parse element reference else if (atName == "reference") { result.ReferenceElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element display else if (atName == "display") { result.DisplayElement = FhirStringParser.ParseFhirString(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); }
/// <summary> /// Parse LocationPositionComponent /// </summary> public static Hl7.Fhir.Model.Location.LocationPositionComponent ParseLocationPositionComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Location.LocationPositionComponent existingInstance = null) { Hl7.Fhir.Model.Location.LocationPositionComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Location.LocationPositionComponent(); 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 longitude else if (atName == "longitude") { result.LongitudeElement = FhirDecimalParser.ParseFhirDecimal(reader, errors); } // Parse element latitude else if (atName == "latitude") { result.LatitudeElement = FhirDecimalParser.ParseFhirDecimal(reader, errors); } // Parse element altitude else if (atName == "altitude") { result.AltitudeElement = FhirDecimalParser.ParseFhirDecimal(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); }
/// <summary> /// Parse ConceptSetFilterComponent /// </summary> public static Hl7.Fhir.Model.ValueSet.ConceptSetFilterComponent ParseConceptSetFilterComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ValueSet.ConceptSetFilterComponent existingInstance = null) { Hl7.Fhir.Model.ValueSet.ConceptSetFilterComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ValueSet.ConceptSetFilterComponent(); 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 property else if (atName == "property") { result.PropertyElement = CodeParser.ParseCode(reader, errors); } // Parse element op else if (atName == "op") { result.OpElement = CodeParser.ParseCode <Hl7.Fhir.Model.ValueSet.FilterOperator>(reader, errors); } // Parse element value else if (atName == "value") { result.ValueElement = CodeParser.ParseCode(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); }
/// <summary> /// Parse CoverageSubscriberComponent /// </summary> public static Hl7.Fhir.Model.Coverage.CoverageSubscriberComponent ParseCoverageSubscriberComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Coverage.CoverageSubscriberComponent existingInstance = null) { Hl7.Fhir.Model.Coverage.CoverageSubscriberComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Coverage.CoverageSubscriberComponent(); 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 name else if (atName == "name") { result.Name = HumanNameParser.ParseHumanName(reader, errors); } // Parse element address else if (atName == "address") { result.Address = AddressParser.ParseAddress(reader, errors); } // Parse element birthdate else if (atName == "birthdate") { result.BirthdateElement = DateParser.ParseDate(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); }
/// <summary> /// Parse ImmunizationReactionComponent /// </summary> public static Hl7.Fhir.Model.Immunization.ImmunizationReactionComponent ParseImmunizationReactionComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Immunization.ImmunizationReactionComponent existingInstance = null) { Hl7.Fhir.Model.Immunization.ImmunizationReactionComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Immunization.ImmunizationReactionComponent(); 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 date else if (atName == "date") { result.DateElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element detail else if (atName == "detail") { result.Detail = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element reported else if (atName == "reported") { result.ReportedElement = FhirBooleanParser.ParseFhirBoolean(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); }
/// <summary> /// Parse Extension /// </summary> public static Hl7.Fhir.Model.Extension ParseExtension(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Extension existingInstance = null) { Hl7.Fhir.Model.Extension result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Extension(); 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 url else if (atName == "url") { result.UrlElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element isModifier else if (atName == "isModifier") { result.IsModifierElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element value else if (atName.StartsWith("value")) { result.Value = FhirParser.ParseElement(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); }
/// <summary> /// Parse VisitHospitalizationAccomodationComponent /// </summary> public static Hl7.Fhir.Model.Visit.VisitHospitalizationAccomodationComponent ParseVisitHospitalizationAccomodationComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Visit.VisitHospitalizationAccomodationComponent existingInstance = null) { Hl7.Fhir.Model.Visit.VisitHospitalizationAccomodationComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Visit.VisitHospitalizationAccomodationComponent(); try { 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.LocalId = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element bed else if (atName == "bed") { result.Bed = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element period else if (atName == "period") { result.Period = PeriodParser.ParsePeriod(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(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse AnimalComponent /// </summary> public static Hl7.Fhir.Model.Patient.AnimalComponent ParseAnimalComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Patient.AnimalComponent existingInstance = null) { Hl7.Fhir.Model.Patient.AnimalComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Patient.AnimalComponent(); 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 species else if (atName == "species") { result.Species = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element breed else if (atName == "breed") { result.Breed = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element genderStatus else if (atName == "genderStatus") { result.GenderStatus = CodeableConceptParser.ParseCodeableConcept(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); }
/// <summary> /// Parse DeviceIdentityComponent /// </summary> public static Hl7.Fhir.Model.Device.DeviceIdentityComponent ParseDeviceIdentityComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Device.DeviceIdentityComponent existingInstance = null) { Hl7.Fhir.Model.Device.DeviceIdentityComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Device.DeviceIdentityComponent(); 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 gtin else if (atName == "gtin") { result.GtinElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element lot else if (atName == "lot") { result.LotElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element serialNumber else if (atName == "serialNumber") { result.SerialNumberElement = FhirStringParser.ParseFhirString(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); }
/// <summary> /// Parse CarePlanGoalComponent /// </summary> public static Hl7.Fhir.Model.CarePlan.CarePlanGoalComponent ParseCarePlanGoalComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.CarePlan.CarePlanGoalComponent existingInstance = null) { Hl7.Fhir.Model.CarePlan.CarePlanGoalComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.CarePlan.CarePlanGoalComponent(); 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 description else if (atName == "description") { result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element status else if (atName == "status") { result.StatusElement = CodeParser.ParseCode <Hl7.Fhir.Model.CarePlan.CarePlanGoalStatus>(reader, errors); } // Parse element notes else if (atName == "notes") { result.NotesElement = FhirStringParser.ParseFhirString(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); }
/// <summary> /// Parse TypeRefComponent /// </summary> public static Hl7.Fhir.Model.Profile.TypeRefComponent ParseTypeRefComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Profile.TypeRefComponent existingInstance = null) { Hl7.Fhir.Model.Profile.TypeRefComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Profile.TypeRefComponent(); 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 code else if (atName == "code") { result.CodeElement = CodeParser.ParseCode(reader, errors); } // Parse element profile else if (atName == "profile") { result.ProfileElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element bundled else if (atName == "bundled") { result.BundledElement = FhirBooleanParser.ParseFhirBoolean(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); }
/// <summary> /// Parse ElementSlicingComponent /// </summary> public static Hl7.Fhir.Model.Profile.ElementSlicingComponent ParseElementSlicingComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Profile.ElementSlicingComponent existingInstance = null) { Hl7.Fhir.Model.Profile.ElementSlicingComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Profile.ElementSlicingComponent(); 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 discriminator else if (atName == "discriminator") { result.DiscriminatorElement = IdParser.ParseId(reader, errors); } // Parse element ordered else if (atName == "ordered") { result.OrderedElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element rules else if (atName == "rules") { result.RulesElement = CodeParser.ParseCode <Hl7.Fhir.Model.Profile.SlicingRules>(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); }
/// <summary> /// Parse PractitionerQualificationComponent /// </summary> public static Hl7.Fhir.Model.Practitioner.PractitionerQualificationComponent ParsePractitionerQualificationComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Practitioner.PractitionerQualificationComponent existingInstance = null) { Hl7.Fhir.Model.Practitioner.PractitionerQualificationComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Practitioner.PractitionerQualificationComponent(); 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 code else if (atName == "code") { result.Code = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element period else if (atName == "period") { result.Period = PeriodParser.ParsePeriod(reader, errors); } // Parse element issuer else if (atName == "issuer") { result.Issuer = 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); }
/// <summary> /// Parse XdsEntryAuthenticatorComponent /// </summary> public static XdsEntry.XdsEntryAuthenticatorComponent ParseXdsEntryAuthenticatorComponent(IFhirReader reader, ErrorList errors, XdsEntry.XdsEntryAuthenticatorComponent existingInstance = null) { XdsEntry.XdsEntryAuthenticatorComponent result = existingInstance != null ? existingInstance : new XdsEntry.XdsEntryAuthenticatorComponent(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if (ParserUtils.IsAtFhirElement(reader, "extension")) { result.Extension = new List <Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element internalId else if (reader.IsAtRefIdElement()) { result.InternalId = Id.Parse(reader.ReadRefIdContents()); } // Parse element id else if (ParserUtils.IsAtFhirElement(reader, "id")) { result.Id = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element name else if (ParserUtils.IsAtFhirElement(reader, "name")) { result.Name = HumanNameParser.ParseHumanName(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(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse PrescriptionMedicineInactiveIngredientComponent /// </summary> public static Prescription.PrescriptionMedicineInactiveIngredientComponent ParsePrescriptionMedicineInactiveIngredientComponent(IFhirReader reader, ErrorList errors, Prescription.PrescriptionMedicineInactiveIngredientComponent existingInstance = null) { Prescription.PrescriptionMedicineInactiveIngredientComponent result = existingInstance != null ? existingInstance : new Prescription.PrescriptionMedicineInactiveIngredientComponent(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if (ParserUtils.IsAtFhirElement(reader, "extension")) { result.Extension = new List <Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element internalId else if (reader.IsAtRefIdElement()) { result.InternalId = Id.Parse(reader.ReadRefIdContents()); } // Parse element identification else if (ParserUtils.IsAtFhirElement(reader, "identification")) { result.Identification = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element quantity else if (ParserUtils.IsAtFhirElement(reader, "quantity", true)) { result.Quantity = FhirParser.ParseElement(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(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse StudyTreatmentComponent /// </summary> public static Hl7.Fhir.Model.Study.StudyTreatmentComponent ParseStudyTreatmentComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Study.StudyTreatmentComponent existingInstance = null) { Hl7.Fhir.Model.Study.StudyTreatmentComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Study.StudyTreatmentComponent(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if (ParserUtils.IsAtFhirElement(reader, "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 (ParserUtils.IsAtFhirElement(reader, "_id")) { result.LocalId = Id.Parse(reader.ReadPrimitiveContents("id")); } // Parse element role else if (ParserUtils.IsAtFhirElement(reader, "role")) { result.Role = CodeParser.ParseCode <Hl7.Fhir.Model.Study.StudyTreatmentRole>(reader, errors); } // Parse element detail else if (ParserUtils.IsAtFhirElement(reader, "detail")) { result.Detail = ActivityDefinitionParser.ParseActivityDefinition(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(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse ProtocolStepPreconditionConditionComponent /// </summary> public static Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionConditionComponent ParseProtocolStepPreconditionConditionComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionConditionComponent existingInstance = null) { Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionConditionComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionConditionComponent(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if (ParserUtils.IsAtFhirElement(reader, "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 (ParserUtils.IsAtFhirElement(reader, "_id")) { result.LocalId = Id.Parse(reader.ReadPrimitiveContents("id")); } // Parse element type else if (ParserUtils.IsAtFhirElement(reader, "type")) { result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element value else if (ParserUtils.IsAtFhirElement(reader, "value", true)) { result.Value = FhirParser.ParseElement(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(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse ObservationReferenceRangeComponent /// </summary> public static Hl7.Fhir.Model.Observation.ObservationReferenceRangeComponent ParseObservationReferenceRangeComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Observation.ObservationReferenceRangeComponent existingInstance = null) { Hl7.Fhir.Model.Observation.ObservationReferenceRangeComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Observation.ObservationReferenceRangeComponent(); 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 meaning else if (atName == "meaning") { result.Meaning = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element range else if (atName.StartsWith("range")) { result.Range = FhirParser.ParseElement(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); }
/// <summary> /// Parse ElementDefinitionMappingComponent /// </summary> public static Hl7.Fhir.Model.Profile.ElementDefinitionMappingComponent ParseElementDefinitionMappingComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Profile.ElementDefinitionMappingComponent existingInstance = null) { Hl7.Fhir.Model.Profile.ElementDefinitionMappingComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Profile.ElementDefinitionMappingComponent(); 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 target else if (atName == "target") { result.TargetElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element map else if (atName == "map") { result.MapElement = FhirStringParser.ParseFhirString(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); }
/// <summary> /// Parse Ratio /// </summary> public static Hl7.Fhir.Model.Ratio ParseRatio(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Ratio existingInstance = null) { Hl7.Fhir.Model.Ratio result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Ratio(); 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 numerator else if (atName == "numerator") { result.Numerator = QuantityParser.ParseQuantity(reader, errors); } // Parse element denominator else if (atName == "denominator") { result.Denominator = QuantityParser.ParseQuantity(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); }
/// <summary> /// Parse Period /// </summary> public static Hl7.Fhir.Model.Period ParsePeriod(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Period existingInstance = null) { Hl7.Fhir.Model.Period result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Period(); 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 start else if (atName == "start") { result.StartElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element end else if (atName == "end") { result.EndElement = FhirDateTimeParser.ParseFhirDateTime(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); }
/// <summary> /// Parse ImmunizationProfileRecommendationDateCriterionComponent /// </summary> public static Hl7.Fhir.Model.ImmunizationProfile.ImmunizationProfileRecommendationDateCriterionComponent ParseImmunizationProfileRecommendationDateCriterionComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ImmunizationProfile.ImmunizationProfileRecommendationDateCriterionComponent existingInstance = null) { Hl7.Fhir.Model.ImmunizationProfile.ImmunizationProfileRecommendationDateCriterionComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ImmunizationProfile.ImmunizationProfileRecommendationDateCriterionComponent(); 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 code else if (atName == "code") { result.Code = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element value else if (atName == "value") { result.ValueElement = FhirDateTimeParser.ParseFhirDateTime(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); }
/// <summary> /// Parse MedicationProductIngredientComponent /// </summary> public static Hl7.Fhir.Model.Medication.MedicationProductIngredientComponent ParseMedicationProductIngredientComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Medication.MedicationProductIngredientComponent existingInstance = null) { Hl7.Fhir.Model.Medication.MedicationProductIngredientComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Medication.MedicationProductIngredientComponent(); 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 item else if (atName == "item") { result.Item = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element amount else if (atName == "amount") { result.Amount = RatioParser.ParseRatio(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); }
/// <summary> /// Parse ConformanceRestSecurityCertificateComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent ParseConformanceRestSecurityCertificateComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent existingInstance = null) { Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent(); 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 type else if (atName == "type") { result.TypeElement = CodeParser.ParseCode(reader, errors); } // Parse element blob else if (atName == "blob") { result.BlobElement = Base64BinaryParser.ParseBase64Binary(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); }
private static void verifyContinueOnEmptyElements(IFhirReader xfr) { Assert.AreEqual("x", xfr.CurrentElementName); xfr.EnterElement(); Assert.IsTrue(ParserUtils.IsAtFhirElement(xfr)); Assert.AreEqual("someElem", xfr.CurrentElementName); xfr.EnterElement(); Assert.IsTrue(xfr.HasMoreElements()); xfr.SkipSubElementsFor("someElem"); xfr.LeaveElement(); Assert.IsTrue(ParserUtils.IsAtFhirElement(xfr)); Assert.AreEqual("someElem2", xfr.CurrentElementName); xfr.EnterElement(); Assert.IsFalse(xfr.HasMoreElements()); xfr.LeaveElement(); xfr.LeaveElement(); }
/// <summary> /// Parse base64Binary /// </summary> public static Hl7.Fhir.Model.Base64Binary ParseBase64Binary(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Base64Binary existingInstance = null ) { Hl7.Fhir.Model.Base64Binary result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Base64Binary(); 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 value else if( atName == "value" ) result.Value = Base64Binary.Parse(reader.ReadPrimitiveContents(typeof(Base64Binary))).Value; 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; }
/// <summary> /// Parse MedicationDispense /// </summary> public static Hl7.Fhir.Model.MedicationDispense ParseMedicationDispense(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.MedicationDispense existingInstance = null) { Hl7.Fhir.Model.MedicationDispense result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.MedicationDispense(); 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 language else if (atName == "language") { result.LanguageElement = CodeParser.ParseCode(reader, errors); } // Parse element text else if (atName == "text") { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (atName == "contained") { result.Contained = new List <Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element identifier else if (atName == "identifier") { result.Identifier = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element status else if (atName == "status") { result.StatusElement = CodeParser.ParseCode <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatus>(reader, errors); } // Parse element patient else if (atName == "patient") { result.Patient = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element dispenser else if (atName == "dispenser") { result.Dispenser = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element authorizingPrescription else if (atName == "authorizingPrescription") { result.AuthorizingPrescription = new List <Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "authorizingPrescription")) { result.AuthorizingPrescription.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } // Parse element dispense else if (atName == "dispense") { result.Dispense = new List <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "dispense")) { result.Dispense.Add(MedicationDispenseParser.ParseMedicationDispenseDispenseComponent(reader, errors)); } reader.LeaveArray(); } // Parse element substitution else if (atName == "substitution") { result.Substitution = MedicationDispenseParser.ParseMedicationDispenseSubstitutionComponent(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); }
/// <summary> /// Parse Supply /// </summary> public static Hl7.Fhir.Model.Supply ParseSupply(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Supply existingInstance = null ) { Hl7.Fhir.Model.Supply result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Supply(); 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 language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element name else if( atName == "name" ) result.Name = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element identifier else if( atName == "identifier" ) result.Identifier = IdentifierParser.ParseIdentifier(reader, errors); // Parse element status else if( atName == "status" ) result.StatusElement = CodeParser.ParseCode(reader, errors); // Parse element orderedItem else if( atName == "orderedItem" ) result.OrderedItem = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element patient else if( atName == "patient" ) result.Patient = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element dispense else if( atName == "dispense" ) { result.Dispense = new List<Hl7.Fhir.Model.Supply.SupplyDispenseComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "dispense") ) result.Dispense.Add(SupplyParser.ParseSupplyDispenseComponent(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse ConformanceRestSecurityComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent ParseConformanceRestSecurityComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent(); 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 service else if( atName == "service" ) { result.Service = new List<Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "service") ) result.Service.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); reader.LeaveArray(); } // Parse element description else if( atName == "description" ) result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element certificate else if( atName == "certificate" ) { result.Certificate = new List<Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "certificate") ) result.Certificate.Add(ConformanceParser.ParseConformanceRestSecurityCertificateComponent(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse ConformanceRestResourceComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent ParseConformanceRestResourceComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent(); 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 type else if( atName == "type" ) result.TypeElement = CodeParser.ParseCode(reader, errors); // Parse element profile else if( atName == "profile" ) result.Profile = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element operation else if( atName == "operation" ) { result.Operation = new List<Hl7.Fhir.Model.Conformance.ConformanceRestResourceOperationComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "operation") ) result.Operation.Add(ConformanceParser.ParseConformanceRestResourceOperationComponent(reader, errors)); reader.LeaveArray(); } // Parse element readHistory else if( atName == "readHistory" ) result.ReadHistoryElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element searchInclude else if( atName == "searchInclude" ) { result.SearchIncludeElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "searchInclude") ) result.SearchIncludeElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } // Parse element searchParam else if( atName == "searchParam" ) { result.SearchParam = new List<Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "searchParam") ) result.SearchParam.Add(ConformanceParser.ParseConformanceRestResourceSearchParamComponent(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse ConformanceRestComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestComponent ParseConformanceRestComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceRestComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestComponent(); 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 mode else if( atName == "mode" ) result.ModeElement = CodeParser.ParseCode<Hl7.Fhir.Model.Conformance.RestfulConformanceMode>(reader, errors); // Parse element documentation else if( atName == "documentation" ) result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element security else if( atName == "security" ) result.Security = ConformanceParser.ParseConformanceRestSecurityComponent(reader, errors); // Parse element resource else if( atName == "resource" ) { result.Resource = new List<Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "resource") ) result.Resource.Add(ConformanceParser.ParseConformanceRestResourceComponent(reader, errors)); reader.LeaveArray(); } // Parse element batch else if( atName == "batch" ) result.BatchElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element history else if( atName == "history" ) result.HistoryElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element query else if( atName == "query" ) { result.Query = new List<Hl7.Fhir.Model.Conformance.ConformanceRestQueryComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "query") ) result.Query.Add(ConformanceParser.ParseConformanceRestQueryComponent(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse FamilyHistoryRelationConditionComponent /// </summary> public static Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationConditionComponent ParseFamilyHistoryRelationConditionComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationConditionComponent existingInstance = null ) { Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationConditionComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationConditionComponent(); 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 type else if( atName == "type" ) result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element outcome else if( atName == "outcome" ) result.Outcome = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element onset else if( atName.StartsWith("onset") ) result.Onset = FhirParser.ParseElement(reader, errors); // Parse element note else if( atName == "note" ) result.NoteElement = FhirStringParser.ParseFhirString(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; }
/// <summary> /// Parse Address /// </summary> public static Hl7.Fhir.Model.Address ParseAddress(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Address existingInstance = null) { Hl7.Fhir.Model.Address result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Address(); 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 use else if (atName == "use") { result.UseElement = CodeParser.ParseCode <Hl7.Fhir.Model.Address.AddressUse>(reader, errors); } // Parse element text else if (atName == "text") { result.TextElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element line else if (atName == "line") { result.LineElement = new List <Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "line")) { result.LineElement.Add(FhirStringParser.ParseFhirString(reader, errors)); } reader.LeaveArray(); } // Parse element city else if (atName == "city") { result.CityElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element state else if (atName == "state") { result.StateElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element zip else if (atName == "zip") { result.ZipElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element country else if (atName == "country") { result.CountryElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element period else if (atName == "period") { result.Period = PeriodParser.ParsePeriod(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); }
/// <summary> /// Parse Identifier /// </summary> public static Hl7.Fhir.Model.Identifier ParseIdentifier(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Identifier existingInstance = null) { Hl7.Fhir.Model.Identifier result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Identifier(); 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 use else if (atName == "use") { result.UseElement = CodeParser.ParseCode <Hl7.Fhir.Model.Identifier.IdentifierUse>(reader, errors); } // Parse element label else if (atName == "label") { result.LabelElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element system else if (atName == "system") { result.SystemElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element key else if (atName == "key") { result.KeyElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element period else if (atName == "period") { result.Period = PeriodParser.ParsePeriod(reader, errors); } // Parse element assigner else if (atName == "assigner") { result.Assigner = 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); }
/// <summary> /// Parse HumanName /// </summary> public static Hl7.Fhir.Model.HumanName ParseHumanName(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.HumanName existingInstance = null ) { Hl7.Fhir.Model.HumanName result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.HumanName(); 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 use else if( atName == "use" ) result.UseElement = CodeParser.ParseCode<Hl7.Fhir.Model.HumanName.NameUse>(reader, errors); // Parse element text else if( atName == "text" ) result.TextElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element family else if( atName == "family" ) { result.FamilyElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "family") ) result.FamilyElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } // Parse element given else if( atName == "given" ) { result.GivenElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "given") ) result.GivenElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } // Parse element prefix else if( atName == "prefix" ) { result.PrefixElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "prefix") ) result.PrefixElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } // Parse element suffix else if( atName == "suffix" ) { result.SuffixElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "suffix") ) result.SuffixElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } // Parse element period else if( atName == "period" ) result.Period = PeriodParser.ParsePeriod(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; }
/// <summary> /// Parse Attachment /// </summary> public static Hl7.Fhir.Model.Attachment ParseAttachment(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Attachment existingInstance = null ) { Hl7.Fhir.Model.Attachment result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Attachment(); 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 contentType else if( atName == "contentType" ) result.ContentTypeElement = CodeParser.ParseCode(reader, errors); // Parse element language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element data else if( atName == "data" ) result.DataElement = Base64BinaryParser.ParseBase64Binary(reader, errors); // Parse element url else if( atName == "url" ) result.UrlElement = FhirUriParser.ParseFhirUri(reader, errors); // Parse element size else if( atName == "size" ) result.SizeElement = IntegerParser.ParseInteger(reader, errors); // Parse element hash else if( atName == "hash" ) result.HashElement = Base64BinaryParser.ParseBase64Binary(reader, errors); // Parse element title else if( atName == "title" ) result.TitleElement = FhirStringParser.ParseFhirString(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; }
/// <summary> /// Parse MedicationAdministration /// </summary> public static Hl7.Fhir.Model.MedicationAdministration ParseMedicationAdministration(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.MedicationAdministration existingInstance = null ) { Hl7.Fhir.Model.MedicationAdministration result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.MedicationAdministration(); 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 language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element identifier else if( atName == "identifier" ) { result.Identifier = new List<Hl7.Fhir.Model.Identifier>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "identifier") ) result.Identifier.Add(IdentifierParser.ParseIdentifier(reader, errors)); reader.LeaveArray(); } // Parse element status else if( atName == "status" ) result.StatusElement = CodeParser.ParseCode<Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatus>(reader, errors); // Parse element patient else if( atName == "patient" ) result.Patient = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element practitioner else if( atName == "practitioner" ) result.Practitioner = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element encounter else if( atName == "encounter" ) result.Encounter = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element prescription else if( atName == "prescription" ) result.Prescription = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element wasNotGiven else if( atName == "wasNotGiven" ) result.WasNotGivenElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element reasonNotGiven else if( atName == "reasonNotGiven" ) { result.ReasonNotGiven = new List<Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "reasonNotGiven") ) result.ReasonNotGiven.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); reader.LeaveArray(); } // Parse element whenGiven else if( atName == "whenGiven" ) result.WhenGiven = PeriodParser.ParsePeriod(reader, errors); // Parse element medication else if( atName == "medication" ) result.Medication = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element administrationDevice else if( atName == "administrationDevice" ) { result.AdministrationDevice = new List<Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "administrationDevice") ) result.AdministrationDevice.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); reader.LeaveArray(); } // Parse element dosage else if( atName == "dosage" ) { result.Dosage = new List<Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationDosageComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "dosage") ) result.Dosage.Add(MedicationAdministrationParser.ParseMedicationAdministrationDosageComponent(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse Substance /// </summary> public static Hl7.Fhir.Model.Substance ParseSubstance(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Substance existingInstance = null ) { Hl7.Fhir.Model.Substance result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Substance(); 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 language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element identifier else if( atName == "identifier" ) result.Identifier = IdentifierParser.ParseIdentifier(reader, errors); // Parse element name else if( atName == "name" ) result.NameElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element type else if( atName == "type" ) result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element description else if( atName == "description" ) result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element status else if( atName == "status" ) result.Status = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element effectiveTime else if( atName == "effectiveTime" ) result.EffectiveTime = PeriodParser.ParsePeriod(reader, errors); // Parse element quantity else if( atName == "quantity" ) result.Quantity = QuantityParser.ParseQuantity(reader, errors); // Parse element ingredient else if( atName == "ingredient" ) { result.Ingredient = new List<Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "ingredient") ) result.Ingredient.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); reader.LeaveArray(); } // Parse element quantityMode else if( atName == "quantityMode" ) result.QuantityMode = CodeableConceptParser.ParseCodeableConcept(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; }
/// <summary> /// Parse RelatedPerson /// </summary> public static Hl7.Fhir.Model.RelatedPerson ParseRelatedPerson(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.RelatedPerson existingInstance = null ) { Hl7.Fhir.Model.RelatedPerson result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.RelatedPerson(); 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 language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element identifier else if( atName == "identifier" ) { result.Identifier = new List<Hl7.Fhir.Model.Identifier>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "identifier") ) result.Identifier.Add(IdentifierParser.ParseIdentifier(reader, errors)); reader.LeaveArray(); } // Parse element patient else if( atName == "patient" ) result.Patient = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element relationship else if( atName == "relationship" ) result.Relationship = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element name else if( atName == "name" ) result.Name = HumanNameParser.ParseHumanName(reader, errors); // Parse element telecom else if( atName == "telecom" ) { result.Telecom = new List<Hl7.Fhir.Model.Contact>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "telecom") ) result.Telecom.Add(ContactParser.ParseContact(reader, errors)); reader.LeaveArray(); } // Parse element gender else if( atName == "gender" ) result.Gender = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element address else if( atName == "address" ) result.Address = AddressParser.ParseAddress(reader, errors); // Parse element photo else if( atName == "photo" ) { result.Photo = new List<Hl7.Fhir.Model.Attachment>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "photo") ) result.Photo.Add(AttachmentParser.ParseAttachment(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse GroupCharacteristicComponent /// </summary> public static Hl7.Fhir.Model.Group.GroupCharacteristicComponent ParseGroupCharacteristicComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Group.GroupCharacteristicComponent existingInstance = null ) { Hl7.Fhir.Model.Group.GroupCharacteristicComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Group.GroupCharacteristicComponent(); 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 type else if( atName == "type" ) result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element value else if( atName.StartsWith("value") ) result.Value = FhirParser.ParseElement(reader, errors); // Parse element exclude else if( atName == "exclude" ) result.ExcludeElement = FhirBooleanParser.ParseFhirBoolean(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; }
/// <summary> /// Parse OperationOutcome /// </summary> public static Hl7.Fhir.Model.OperationOutcome ParseOperationOutcome(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.OperationOutcome existingInstance = null ) { Hl7.Fhir.Model.OperationOutcome result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.OperationOutcome(); 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 language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element issue else if( atName == "issue" ) { result.Issue = new List<Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "issue") ) result.Issue.Add(OperationOutcomeParser.ParseOperationOutcomeIssueComponent(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse Group /// </summary> public static Hl7.Fhir.Model.Group ParseGroup(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Group existingInstance = null ) { Hl7.Fhir.Model.Group result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Group(); 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 language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element identifier else if( atName == "identifier" ) result.Identifier = IdentifierParser.ParseIdentifier(reader, errors); // Parse element type else if( atName == "type" ) result.TypeElement = CodeParser.ParseCode<Hl7.Fhir.Model.Group.GroupType>(reader, errors); // Parse element actual else if( atName == "actual" ) result.ActualElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element code else if( atName == "code" ) result.Code = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element name else if( atName == "name" ) result.NameElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element quantity else if( atName == "quantity" ) result.QuantityElement = IntegerParser.ParseInteger(reader, errors); // Parse element characteristic else if( atName == "characteristic" ) { result.Characteristic = new List<Hl7.Fhir.Model.Group.GroupCharacteristicComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "characteristic") ) result.Characteristic.Add(GroupParser.ParseGroupCharacteristicComponent(reader, errors)); reader.LeaveArray(); } // Parse element member else if( atName == "member" ) { result.Member = new List<Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "member") ) result.Member.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse ConformanceMessagingComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent ParseConformanceMessagingComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent(); 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 endpoint else if( atName == "endpoint" ) result.EndpointElement = FhirUriParser.ParseFhirUri(reader, errors); // Parse element reliableCache else if( atName == "reliableCache" ) result.ReliableCacheElement = IntegerParser.ParseInteger(reader, errors); // Parse element documentation else if( atName == "documentation" ) result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element event else if( atName == "event" ) { result.Event = new List<Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "event") ) result.Event.Add(ConformanceParser.ParseConformanceMessagingEventComponent(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse Choice /// </summary> public static Hl7.Fhir.Model.Choice ParseChoice(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Choice existingInstance = null ) { Hl7.Fhir.Model.Choice result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Choice(); 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 code else if( atName == "code" ) result.CodeElement = CodeParser.ParseCode(reader, errors); // Parse element option else if( atName == "option" ) { result.Option = new List<Hl7.Fhir.Model.Choice.ChoiceOptionComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "option") ) result.Option.Add(ChoiceParser.ParseChoiceOptionComponent(reader, errors)); reader.LeaveArray(); } // Parse element isOrdered else if( atName == "isOrdered" ) result.IsOrderedElement = FhirBooleanParser.ParseFhirBoolean(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; }
/// <summary> /// Parse FamilyHistory /// </summary> public static Hl7.Fhir.Model.FamilyHistory ParseFamilyHistory(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.FamilyHistory existingInstance = null ) { Hl7.Fhir.Model.FamilyHistory result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.FamilyHistory(); 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 language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element subject else if( atName == "subject" ) result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element note else if( atName == "note" ) result.NoteElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element relation else if( atName == "relation" ) { result.Relation = new List<Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "relation") ) result.Relation.Add(FamilyHistoryParser.ParseFamilyHistoryRelationComponent(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse OperationOutcomeIssueComponent /// </summary> public static Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent ParseOperationOutcomeIssueComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent existingInstance = null ) { Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent(); 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 severity else if( atName == "severity" ) result.SeverityElement = CodeParser.ParseCode<Hl7.Fhir.Model.OperationOutcome.IssueSeverity>(reader, errors); // Parse element type else if( atName == "type" ) result.Type = CodingParser.ParseCoding(reader, errors); // Parse element details else if( atName == "details" ) result.DetailsElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element location else if( atName == "location" ) { result.LocationElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "location") ) result.LocationElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse EncounterHospitalizationComponent /// </summary> public static Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent ParseEncounterHospitalizationComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent existingInstance = null ) { Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent(); 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 preAdmissionIdentifier else if( atName == "preAdmissionIdentifier" ) result.PreAdmissionIdentifier = IdentifierParser.ParseIdentifier(reader, errors); // Parse element origin else if( atName == "origin" ) result.Origin = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element admitSource else if( atName == "admitSource" ) result.AdmitSource = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element period else if( atName == "period" ) result.Period = PeriodParser.ParsePeriod(reader, errors); // Parse element accomodation else if( atName == "accomodation" ) { result.Accomodation = new List<Hl7.Fhir.Model.Encounter.EncounterHospitalizationAccomodationComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "accomodation") ) result.Accomodation.Add(EncounterParser.ParseEncounterHospitalizationAccomodationComponent(reader, errors)); reader.LeaveArray(); } // Parse element diet else if( atName == "diet" ) result.Diet = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element specialCourtesy else if( atName == "specialCourtesy" ) { result.SpecialCourtesy = new List<Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "specialCourtesy") ) result.SpecialCourtesy.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); reader.LeaveArray(); } // Parse element specialArrangement else if( atName == "specialArrangement" ) { result.SpecialArrangement = new List<Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "specialArrangement") ) result.SpecialArrangement.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); reader.LeaveArray(); } // Parse element destination else if( atName == "destination" ) result.Destination = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element dischargeDisposition else if( atName == "dischargeDisposition" ) result.DischargeDisposition = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element reAdmission else if( atName == "reAdmission" ) result.ReAdmissionElement = FhirBooleanParser.ParseFhirBoolean(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; }
/// <summary> /// Parse AnatomicalLocation /// </summary> public static AnatomicalLocation ParseAnatomicalLocation(IFhirReader reader, ErrorList errors, AnatomicalLocation existingInstance = null ) { AnatomicalLocation result = existingInstance != null ? existingInstance : new AnatomicalLocation(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if( ParserUtils.IsAtFhirElement(reader, "extension") ) { result.Extension = new List<Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element language else if( ParserUtils.IsAtFhirElement(reader, "language") ) result.Language = CodeParser.ParseCode(reader, errors); // Parse element text else if( ParserUtils.IsAtFhirElement(reader, "text") ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( ParserUtils.IsAtFhirElement(reader, "contained") ) { result.Contained = new List<Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element internalId else if( reader.IsAtRefIdElement() ) result.InternalId = Id.Parse(reader.ReadRefIdContents()); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return result; }
/// <summary> /// Parse EncounterParticipantComponent /// </summary> public static Hl7.Fhir.Model.Encounter.EncounterParticipantComponent ParseEncounterParticipantComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Encounter.EncounterParticipantComponent existingInstance = null ) { Hl7.Fhir.Model.Encounter.EncounterParticipantComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Encounter.EncounterParticipantComponent(); 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 type else if( atName == "type" ) { result.TypeElement = new List<Code<Hl7.Fhir.Model.Encounter.ParticipantType>>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "type") ) result.TypeElement.Add(CodeParser.ParseCode<Hl7.Fhir.Model.Encounter.ParticipantType>(reader, errors)); reader.LeaveArray(); } // Parse element practitioner else if( atName == "practitioner" ) result.Practitioner = 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; }
/// <summary> /// Parse ConformanceMessagingEventComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent ParseConformanceMessagingEventComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent(); 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 code else if( atName == "code" ) result.CodeElement = CodeParser.ParseCode(reader, errors); // Parse element mode else if( atName == "mode" ) result.ModeElement = CodeParser.ParseCode<Hl7.Fhir.Model.Conformance.ConformanceEventMode>(reader, errors); // Parse element protocol else if( atName == "protocol" ) { result.Protocol = new List<Hl7.Fhir.Model.Coding>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "protocol") ) result.Protocol.Add(CodingParser.ParseCoding(reader, errors)); reader.LeaveArray(); } // Parse element focus else if( atName == "focus" ) result.FocusElement = CodeParser.ParseCode(reader, errors); // Parse element request else if( atName == "request" ) result.Request = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element response else if( atName == "response" ) result.Response = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element documentation else if( atName == "documentation" ) result.DocumentationElement = FhirStringParser.ParseFhirString(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; }
/// <summary> /// Parse Encounter /// </summary> public static Hl7.Fhir.Model.Encounter ParseEncounter(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Encounter existingInstance = null ) { Hl7.Fhir.Model.Encounter result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Encounter(); 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 language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element identifier else if( atName == "identifier" ) { result.Identifier = new List<Hl7.Fhir.Model.Identifier>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "identifier") ) result.Identifier.Add(IdentifierParser.ParseIdentifier(reader, errors)); reader.LeaveArray(); } // Parse element status else if( atName == "status" ) result.StatusElement = CodeParser.ParseCode<Hl7.Fhir.Model.Encounter.EncounterState>(reader, errors); // Parse element class else if( atName == "class" ) result.ClassElement = CodeParser.ParseCode<Hl7.Fhir.Model.Encounter.EncounterClass>(reader, errors); // Parse element type else if( atName == "type" ) { result.Type = new List<Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "type") ) result.Type.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); reader.LeaveArray(); } // Parse element subject else if( atName == "subject" ) result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element participant else if( atName == "participant" ) { result.Participant = new List<Hl7.Fhir.Model.Encounter.EncounterParticipantComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "participant") ) result.Participant.Add(EncounterParser.ParseEncounterParticipantComponent(reader, errors)); reader.LeaveArray(); } // Parse element fulfills else if( atName == "fulfills" ) result.Fulfills = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element start else if( atName == "start" ) result.StartElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); // Parse element length else if( atName == "length" ) result.Length = DurationParser.ParseDuration(reader, errors); // Parse element reason else if( atName.StartsWith("reason") ) result.Reason = FhirParser.ParseElement(reader, errors); // Parse element indication else if( atName == "indication" ) result.Indication = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element priority else if( atName == "priority" ) result.Priority = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element hospitalization else if( atName == "hospitalization" ) result.Hospitalization = EncounterParser.ParseEncounterHospitalizationComponent(reader, errors); // Parse element location else if( atName == "location" ) { result.Location = new List<Hl7.Fhir.Model.Encounter.EncounterLocationComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "location") ) result.Location.Add(EncounterParser.ParseEncounterLocationComponent(reader, errors)); reader.LeaveArray(); } // Parse element serviceProvider else if( atName == "serviceProvider" ) result.ServiceProvider = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element partOf else if( atName == "partOf" ) result.PartOf = 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; }
/// <summary> /// Parse Conformance /// </summary> public static Hl7.Fhir.Model.Conformance ParseConformance(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance existingInstance = null ) { Hl7.Fhir.Model.Conformance result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance(); 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 language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element identifier else if( atName == "identifier" ) result.IdentifierElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element version else if( atName == "version" ) result.VersionElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element name else if( atName == "name" ) result.NameElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element publisher else if( atName == "publisher" ) result.PublisherElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element telecom else if( atName == "telecom" ) { result.Telecom = new List<Hl7.Fhir.Model.Contact>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "telecom") ) result.Telecom.Add(ContactParser.ParseContact(reader, errors)); reader.LeaveArray(); } // Parse element description else if( atName == "description" ) result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element status else if( atName == "status" ) result.StatusElement = CodeParser.ParseCode<Hl7.Fhir.Model.Conformance.ConformanceStatementStatus>(reader, errors); // Parse element experimental else if( atName == "experimental" ) result.ExperimentalElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element date else if( atName == "date" ) result.DateElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); // Parse element software else if( atName == "software" ) result.Software = ConformanceParser.ParseConformanceSoftwareComponent(reader, errors); // Parse element implementation else if( atName == "implementation" ) result.Implementation = ConformanceParser.ParseConformanceImplementationComponent(reader, errors); // Parse element fhirVersion else if( atName == "fhirVersion" ) result.FhirVersionElement = IdParser.ParseId(reader, errors); // Parse element acceptUnknown else if( atName == "acceptUnknown" ) result.AcceptUnknownElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element format else if( atName == "format" ) { result.FormatElement = new List<Hl7.Fhir.Model.Code>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "format") ) result.FormatElement.Add(CodeParser.ParseCode(reader, errors)); reader.LeaveArray(); } // Parse element rest else if( atName == "rest" ) { result.Rest = new List<Hl7.Fhir.Model.Conformance.ConformanceRestComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "rest") ) result.Rest.Add(ConformanceParser.ParseConformanceRestComponent(reader, errors)); reader.LeaveArray(); } // Parse element messaging else if( atName == "messaging" ) { result.Messaging = new List<Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "messaging") ) result.Messaging.Add(ConformanceParser.ParseConformanceMessagingComponent(reader, errors)); reader.LeaveArray(); } // Parse element document else if( atName == "document" ) { result.Document = new List<Hl7.Fhir.Model.Conformance.ConformanceDocumentComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "document") ) result.Document.Add(ConformanceParser.ParseConformanceDocumentComponent(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse CodeableConcept /// </summary> public static Hl7.Fhir.Model.CodeableConcept ParseCodeableConcept(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.CodeableConcept existingInstance = null ) { Hl7.Fhir.Model.CodeableConcept result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.CodeableConcept(); 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 coding else if( atName == "coding" ) { result.Coding = new List<Hl7.Fhir.Model.Coding>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "coding") ) result.Coding.Add(CodingParser.ParseCoding(reader, errors)); reader.LeaveArray(); } // Parse element text else if( atName == "text" ) result.TextElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element primary else if( atName == "primary" ) result.PrimaryElement = IdRefParser.ParseIdRef(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; }
/// <summary> /// Parse ConformanceRestResourceSearchParamComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent ParseConformanceRestResourceSearchParamComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent(); 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 name else if( atName == "name" ) result.NameElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element source else if( atName == "source" ) result.SourceElement = FhirUriParser.ParseFhirUri(reader, errors); // Parse element type else if( atName == "type" ) result.TypeElement = CodeParser.ParseCode<Hl7.Fhir.Model.Conformance.SearchParamType>(reader, errors); // Parse element documentation else if( atName == "documentation" ) result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element xpath else if( atName == "xpath" ) result.XpathElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element target else if( atName == "target" ) { result.TargetElement = new List<Hl7.Fhir.Model.Code>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "target") ) result.TargetElement.Add(CodeParser.ParseCode(reader, errors)); reader.LeaveArray(); } // Parse element chain else if( atName == "chain" ) { result.ChainElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "chain") ) result.ChainElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse MedicationDispenseDispenseComponent /// </summary> public static Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseComponent ParseMedicationDispenseDispenseComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseComponent existingInstance = null) { Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseComponent(); 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 identifier else if (atName == "identifier") { result.Identifier = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element status else if (atName == "status") { result.StatusElement = CodeParser.ParseCode <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatus>(reader, errors); } // Parse element type else if (atName == "type") { result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element quantity else if (atName == "quantity") { result.Quantity = QuantityParser.ParseQuantity(reader, errors); } // Parse element medication else if (atName == "medication") { result.Medication = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element whenPrepared else if (atName == "whenPrepared") { result.WhenPrepared = PeriodParser.ParsePeriod(reader, errors); } // Parse element whenHandedOver else if (atName == "whenHandedOver") { result.WhenHandedOver = PeriodParser.ParsePeriod(reader, errors); } // Parse element destination else if (atName == "destination") { result.Destination = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element receiver else if (atName == "receiver") { result.Receiver = new List <Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "receiver")) { result.Receiver.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } // Parse element dosage else if (atName == "dosage") { result.Dosage = new List <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseDosageComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "dosage")) { result.Dosage.Add(MedicationDispenseParser.ParseMedicationDispenseDispenseDosageComponent(reader, errors)); } reader.LeaveArray(); } 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); }
/// <summary> /// Parse ConformanceSoftwareComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent ParseConformanceSoftwareComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent(); 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 name else if( atName == "name" ) result.NameElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element version else if( atName == "version" ) result.VersionElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element releaseDate else if( atName == "releaseDate" ) result.ReleaseDateElement = FhirDateTimeParser.ParseFhirDateTime(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; }
/// <summary> /// Parse SupplyDispenseComponent /// </summary> public static Hl7.Fhir.Model.Supply.SupplyDispenseComponent ParseSupplyDispenseComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Supply.SupplyDispenseComponent existingInstance = null ) { Hl7.Fhir.Model.Supply.SupplyDispenseComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Supply.SupplyDispenseComponent(); 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 identifier else if( atName == "identifier" ) result.Identifier = IdentifierParser.ParseIdentifier(reader, errors); // Parse element status else if( atName == "status" ) result.StatusElement = CodeParser.ParseCode(reader, errors); // Parse element type else if( atName == "type" ) result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element quantity else if( atName == "quantity" ) result.Quantity = QuantityParser.ParseQuantity(reader, errors); // Parse element suppliedItem else if( atName == "suppliedItem" ) result.SuppliedItem = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element supplier else if( atName == "supplier" ) result.Supplier = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element whenPrepared else if( atName == "whenPrepared" ) result.WhenPrepared = PeriodParser.ParsePeriod(reader, errors); // Parse element whenHandedOver else if( atName == "whenHandedOver" ) result.WhenHandedOver = PeriodParser.ParsePeriod(reader, errors); // Parse element destination else if( atName == "destination" ) result.Destination = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element receiver else if( atName == "receiver" ) { result.Receiver = new List<Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "receiver") ) result.Receiver.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); reader.LeaveArray(); } 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; }
/// <summary> /// Parse Test /// </summary> public static Hl7.Fhir.Model.Test ParseTest(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Test existingInstance = null) { Hl7.Fhir.Model.Test result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Test(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if (ParserUtils.IsAtFhirElement(reader, "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 language else if (ParserUtils.IsAtFhirElement(reader, "language")) { result.Language = CodeParser.ParseCode(reader, errors); } // Parse element text else if (ParserUtils.IsAtFhirElement(reader, "text")) { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (ParserUtils.IsAtFhirElement(reader, "contained")) { result.Contained = new List <Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (ParserUtils.IsAtFhirElement(reader, "_id")) { result.LocalId = Id.Parse(reader.ReadPrimitiveContents("id")); } // Parse element stringErr else if (ParserUtils.IsAtFhirElement(reader, "stringErr")) { result.StringErr = new List <Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "stringErr")) { result.StringErr.Add(FhirStringParser.ParseFhirString(reader, errors)); } reader.LeaveArray(); } // Parse element stringCorr else if (ParserUtils.IsAtFhirElement(reader, "stringCorr")) { result.StringCorr = new List <Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "stringCorr")) { result.StringCorr.Add(FhirStringParser.ParseFhirString(reader, errors)); } reader.LeaveArray(); } // Parse element booleanErr else if (ParserUtils.IsAtFhirElement(reader, "booleanErr")) { result.BooleanErr = new List <Hl7.Fhir.Model.FhirBoolean>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "booleanErr")) { result.BooleanErr.Add(FhirBooleanParser.ParseFhirBoolean(reader, errors)); } reader.LeaveArray(); } // Parse element booleanCorr else if (ParserUtils.IsAtFhirElement(reader, "booleanCorr")) { result.BooleanCorr = new List <Hl7.Fhir.Model.FhirBoolean>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "booleanCorr")) { result.BooleanCorr.Add(FhirBooleanParser.ParseFhirBoolean(reader, errors)); } reader.LeaveArray(); } // Parse element integerErr else if (ParserUtils.IsAtFhirElement(reader, "integerErr")) { result.IntegerErr = new List <Hl7.Fhir.Model.Integer>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "integerErr")) { result.IntegerErr.Add(IntegerParser.ParseInteger(reader, errors)); } reader.LeaveArray(); } // Parse element integerCorr else if (ParserUtils.IsAtFhirElement(reader, "integerCorr")) { result.IntegerCorr = new List <Hl7.Fhir.Model.Integer>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "integerCorr")) { result.IntegerCorr.Add(IntegerParser.ParseInteger(reader, errors)); } reader.LeaveArray(); } // Parse element decimalErr else if (ParserUtils.IsAtFhirElement(reader, "decimalErr")) { result.DecimalErr = new List <Hl7.Fhir.Model.FhirDecimal>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "decimalErr")) { result.DecimalErr.Add(FhirDecimalParser.ParseFhirDecimal(reader, errors)); } reader.LeaveArray(); } // Parse element decimalCorr else if (ParserUtils.IsAtFhirElement(reader, "decimalCorr")) { result.DecimalCorr = new List <Hl7.Fhir.Model.FhirDecimal>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "decimalCorr")) { result.DecimalCorr.Add(FhirDecimalParser.ParseFhirDecimal(reader, errors)); } reader.LeaveArray(); } // Parse element b64Err else if (ParserUtils.IsAtFhirElement(reader, "b64Err")) { result.B64Err = new List <Hl7.Fhir.Model.Base64Binary>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "b64Err")) { result.B64Err.Add(Base64BinaryParser.ParseBase64Binary(reader, errors)); } reader.LeaveArray(); } // Parse element b64Corr else if (ParserUtils.IsAtFhirElement(reader, "b64Corr")) { result.B64Corr = new List <Hl7.Fhir.Model.Base64Binary>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "b64Corr")) { result.B64Corr.Add(Base64BinaryParser.ParseBase64Binary(reader, errors)); } reader.LeaveArray(); } // Parse element instantErr else if (ParserUtils.IsAtFhirElement(reader, "instantErr")) { result.InstantErr = new List <Hl7.Fhir.Model.Instant>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "instantErr")) { result.InstantErr.Add(InstantParser.ParseInstant(reader, errors)); } reader.LeaveArray(); } // Parse element instantCorr else if (ParserUtils.IsAtFhirElement(reader, "instantCorr")) { result.InstantCorr = new List <Hl7.Fhir.Model.Instant>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "instantCorr")) { result.InstantCorr.Add(InstantParser.ParseInstant(reader, errors)); } reader.LeaveArray(); } // Parse element uriErr else if (ParserUtils.IsAtFhirElement(reader, "uriErr")) { result.UriErr = new List <Hl7.Fhir.Model.FhirUri>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "uriErr")) { result.UriErr.Add(FhirUriParser.ParseFhirUri(reader, errors)); } reader.LeaveArray(); } // Parse element uriCorr else if (ParserUtils.IsAtFhirElement(reader, "uriCorr")) { result.UriCorr = new List <Hl7.Fhir.Model.FhirUri>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "uriCorr")) { result.UriCorr.Add(FhirUriParser.ParseFhirUri(reader, errors)); } reader.LeaveArray(); } // Parse element idrefSingle else if (ParserUtils.IsAtFhirElement(reader, "idrefSingle")) { result.IdrefSingle = IdRefParser.ParseIdRef(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(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse MedicationAdministrationDosageComponent /// </summary> public static Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationDosageComponent ParseMedicationAdministrationDosageComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationDosageComponent existingInstance = null ) { Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationDosageComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationDosageComponent(); 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 timing else if( atName == "timing" ) result.Timing = ScheduleParser.ParseSchedule(reader, errors); // Parse element site else if( atName == "site" ) result.Site = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element route else if( atName == "route" ) result.Route = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element method else if( atName == "method" ) result.Method = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element quantity else if( atName == "quantity" ) result.Quantity = QuantityParser.ParseQuantity(reader, errors); // Parse element rate else if( atName == "rate" ) result.Rate = RatioParser.ParseRatio(reader, errors); // Parse element maxDosePerPeriod else if( atName == "maxDosePerPeriod" ) result.MaxDosePerPeriod = RatioParser.ParseRatio(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; }