/// <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 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);
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
        /// <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);
        }
Ejemplo n.º 6
0
        /// <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);
        }
Ejemplo n.º 7
0
        /// <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);
        }
Ejemplo n.º 8
0
        /// <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);
        }
Ejemplo n.º 9
0
        /// <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 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);
        }
Ejemplo n.º 11
0
        /// <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);
        }
Ejemplo n.º 12
0
        /// <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);
        }
Ejemplo n.º 13
0
        /// <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);
        }
Ejemplo n.º 14
0
        /// <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 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);
        }
Ejemplo n.º 16
0
        /// <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);
        }
Ejemplo n.º 17
0
        /// <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 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);
        }
Ejemplo n.º 19
0
        /// <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 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);
        }
Ejemplo n.º 21
0
        /// <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);
        }
Ejemplo n.º 22
0
        /// <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);
        }
Ejemplo n.º 23
0
        /// <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);
        }
Ejemplo n.º 24
0
        /// <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);
        }
Ejemplo n.º 25
0
        /// <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 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 MedicationDispenseDispenseDosageComponent
        /// </summary>
        public static Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseDosageComponent ParseMedicationDispenseDispenseDosageComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseDosageComponent existingInstance = null)
        {
            Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseDosageComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDispenseDosageComponent();
            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 additionalInstructions
                else if (atName.StartsWith("additionalInstructions"))
                {
                    result.AdditionalInstructions = FhirParser.ParseElement(reader, errors);
                }

                // Parse element timing
                else if (atName.StartsWith("timing"))
                {
                    result.Timing = FhirParser.ParseElement(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);
        }
Ejemplo n.º 28
0
        /// <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 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 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);
        }