コード例 #1
0
        /// <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);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
        /// <summary>
        /// Parse ProblemLocationComponent
        /// </summary>
        public static Hl7.Fhir.Model.Problem.ProblemLocationComponent ParseProblemLocationComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Problem.ProblemLocationComponent existingInstance = null)
        {
            Hl7.Fhir.Model.Problem.ProblemLocationComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Problem.ProblemLocationComponent();
            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 code
                    else if (ParserUtils.IsAtFhirElement(reader, "code"))
                    {
                        result.Code = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                    }

                    // Parse element details
                    else if (ParserUtils.IsAtFhirElement(reader, "details"))
                    {
                        result.Details = 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();
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message, reader);
            }
            return(result);
        }
コード例 #6
0
        /// <summary>
        /// Parse XdsEntryAuthorInstitutionComponent
        /// </summary>
        public static XdsEntry.XdsEntryAuthorInstitutionComponent ParseXdsEntryAuthorInstitutionComponent(IFhirReader reader, ErrorList errors, XdsEntry.XdsEntryAuthorInstitutionComponent existingInstance = null)
        {
            XdsEntry.XdsEntryAuthorInstitutionComponent result = existingInstance != null ? existingInstance : new XdsEntry.XdsEntryAuthorInstitutionComponent();
            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 = 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();
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message, reader);
            }
            return(result);
        }
コード例 #7
0
        /// <summary>
        /// Parse SecurityEventObjectDetailComponent
        /// </summary>
        public static Hl7.Fhir.Model.SecurityEvent.SecurityEventObjectDetailComponent ParseSecurityEventObjectDetailComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.SecurityEvent.SecurityEventObjectDetailComponent existingInstance = null)
        {
            Hl7.Fhir.Model.SecurityEvent.SecurityEventObjectDetailComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.SecurityEvent.SecurityEventObjectDetailComponent();
            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 = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element value
                else if (atName == "value")
                {
                    result.ValueElement = 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);
        }
コード例 #8
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);
        }
コード例 #9
0
        /// <summary>
        /// Parse Array
        /// </summary>
        public static Hl7.Fhir.Model.Array ParseArray(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Array existingInstance = null)
        {
            Hl7.Fhir.Model.Array result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Array();
            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 origin
                    else if (ParserUtils.IsAtFhirElement(reader, "origin"))
                    {
                        result.Origin = QuantityParser.ParseQuantity(reader, errors);
                    }

                    // Parse element period
                    else if (ParserUtils.IsAtFhirElement(reader, "period"))
                    {
                        result.Period = FhirDecimalParser.ParseFhirDecimal(reader, errors);
                    }

                    // Parse element factor
                    else if (ParserUtils.IsAtFhirElement(reader, "factor"))
                    {
                        result.Factor = FhirDecimalParser.ParseFhirDecimal(reader, errors);
                    }

                    // Parse element lowerLimit
                    else if (ParserUtils.IsAtFhirElement(reader, "lowerLimit"))
                    {
                        result.LowerLimit = FhirDecimalParser.ParseFhirDecimal(reader, errors);
                    }

                    // Parse element upperLimit
                    else if (ParserUtils.IsAtFhirElement(reader, "upperLimit"))
                    {
                        result.UpperLimit = FhirDecimalParser.ParseFhirDecimal(reader, errors);
                    }

                    // Parse element dimensions
                    else if (ParserUtils.IsAtFhirElement(reader, "dimensions"))
                    {
                        result.Dimensions = IntegerParser.ParseInteger(reader, errors);
                    }

                    // Parse element data
                    else if (ParserUtils.IsAtFhirElement(reader, "data"))
                    {
                        result.Data = 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();
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message, reader);
            }
            return(result);
        }
コード例 #10
0
        /// <summary>
        /// Parse DiagnosticReport
        /// </summary>
        public static Hl7.Fhir.Model.DiagnosticReport ParseDiagnosticReport(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.DiagnosticReport existingInstance = null)
        {
            Hl7.Fhir.Model.DiagnosticReport result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.DiagnosticReport();
            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 status
                else if (atName == "status")
                {
                    result.StatusElement = CodeParser.ParseCode <Hl7.Fhir.Model.ObservationStatus>(reader, errors);
                }

                // Parse element issued
                else if (atName == "issued")
                {
                    result.IssuedElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors);
                }

                // Parse element subject
                else if (atName == "subject")
                {
                    result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element performer
                else if (atName == "performer")
                {
                    result.Performer = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element reportId
                else if (atName == "reportId")
                {
                    result.ReportId = IdentifierParser.ParseIdentifier(reader, errors);
                }

                // Parse element requestDetail
                else if (atName == "requestDetail")
                {
                    result.RequestDetail = new List <Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportRequestDetailComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "requestDetail"))
                    {
                        result.RequestDetail.Add(DiagnosticReportParser.ParseDiagnosticReportRequestDetailComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element serviceCategory
                else if (atName == "serviceCategory")
                {
                    result.ServiceCategory = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                }

                // Parse element diagnosticTime
                else if (atName == "diagnosticTime")
                {
                    result.DiagnosticTimeElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors);
                }

                // Parse element results
                else if (atName == "results")
                {
                    result.Results = DiagnosticReportParser.ParseResultGroupComponent(reader, errors);
                }

                // Parse element image
                else if (atName == "image")
                {
                    result.Image = new List <Hl7.Fhir.Model.ResourceReference>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "image"))
                    {
                        result.Image.Add(ResourceReferenceParser.ParseResourceReference(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element conclusion
                else if (atName == "conclusion")
                {
                    result.ConclusionElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element codedDiagnosis
                else if (atName == "codedDiagnosis")
                {
                    result.CodedDiagnosis = new List <Hl7.Fhir.Model.CodeableConcept>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "codedDiagnosis"))
                    {
                        result.CodedDiagnosis.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element representation
                else if (atName == "representation")
                {
                    result.Representation = new List <Hl7.Fhir.Model.Attachment>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "representation"))
                    {
                        result.Representation.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);
        }
コード例 #11
0
        /// <summary>
        /// Parse Organization
        /// </summary>
        public static Hl7.Fhir.Model.Organization ParseOrganization(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Organization existingInstance = null)
        {
            Hl7.Fhir.Model.Organization result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Organization();
            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 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 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 address
                else if (atName == "address")
                {
                    result.Address = new List <Hl7.Fhir.Model.Address>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "address"))
                    {
                        result.Address.Add(AddressParser.ParseAddress(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element partOf
                else if (atName == "partOf")
                {
                    result.PartOf = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element contact
                else if (atName == "contact")
                {
                    result.Contact = new List <Hl7.Fhir.Model.Organization.OrganizationContactComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "contact"))
                    {
                        result.Contact.Add(OrganizationParser.ParseOrganizationContactComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element active
                else if (atName == "active")
                {
                    result.ActiveElement = 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);
        }
コード例 #12
0
        /// <summary>
        /// Parse DeviceLogItemComponent
        /// </summary>
        public static Hl7.Fhir.Model.DeviceLog.DeviceLogItemComponent ParseDeviceLogItemComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.DeviceLog.DeviceLogItemComponent existingInstance = null)
        {
            Hl7.Fhir.Model.DeviceLog.DeviceLogItemComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.DeviceLog.DeviceLogItemComponent();
            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 key
                else if (atName == "key")
                {
                    result.KeyElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element value
                else if (atName == "value")
                {
                    result.ValueElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element flag
                else if (atName == "flag")
                {
                    result.FlagElement = new List <Code <Hl7.Fhir.Model.DeviceLog.DeviceValueFlag> >();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "flag"))
                    {
                        result.FlagElement.Add(CodeParser.ParseCode <Hl7.Fhir.Model.DeviceLog.DeviceValueFlag>(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);
        }
コード例 #13
0
        /// <summary>
        /// Parse DiagnosticReportRequestDetailComponent
        /// </summary>
        public static Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportRequestDetailComponent ParseDiagnosticReportRequestDetailComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportRequestDetailComponent existingInstance = null)
        {
            Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportRequestDetailComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportRequestDetailComponent();
            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 encounter
                else if (atName == "encounter")
                {
                    result.Encounter = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element requestOrderId
                else if (atName == "requestOrderId")
                {
                    result.RequestOrderId = IdentifierParser.ParseIdentifier(reader, errors);
                }

                // Parse element receiverOrderId
                else if (atName == "receiverOrderId")
                {
                    result.ReceiverOrderId = IdentifierParser.ParseIdentifier(reader, errors);
                }

                // Parse element requestTest
                else if (atName == "requestTest")
                {
                    result.RequestTest = new List <Hl7.Fhir.Model.CodeableConcept>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "requestTest"))
                    {
                        result.RequestTest.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element bodySite
                else if (atName == "bodySite")
                {
                    result.BodySite = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                }

                // Parse element requester
                else if (atName == "requester")
                {
                    result.Requester = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element clinicalInfo
                else if (atName == "clinicalInfo")
                {
                    result.ClinicalInfoElement = 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);
        }
コード例 #14
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);
        }
コード例 #15
0
        /// <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);
        }
コード例 #16
0
        /// <summary>
        /// Parse ImagingStudySeriesComponent
        /// </summary>
        public static Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent ParseImagingStudySeriesComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent existingInstance = null)
        {
            Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent();
            string currentElementName = reader.CurrentElementName;

            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if (atName == "extension")
                {
                    result.Extension = new List <Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "extension"))
                    {
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element _id
                else if (atName == "_id")
                {
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
                }

                // Parse element number
                else if (atName == "number")
                {
                    result.NumberElement = IntegerParser.ParseInteger(reader, errors);
                }

                // Parse element modality
                else if (atName == "modality")
                {
                    result.ModalityElement = CodeParser.ParseCode <Hl7.Fhir.Model.ImagingStudy.Modality>(reader, errors);
                }

                // Parse element uid
                else if (atName == "uid")
                {
                    result.UidElement = OidParser.ParseOid(reader, errors);
                }

                // Parse element description
                else if (atName == "description")
                {
                    result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element numberOfInstances
                else if (atName == "numberOfInstances")
                {
                    result.NumberOfInstancesElement = IntegerParser.ParseInteger(reader, errors);
                }

                // Parse element availability
                else if (atName == "availability")
                {
                    result.AvailabilityElement = CodeParser.ParseCode <Hl7.Fhir.Model.ImagingStudy.InstanceAvailability>(reader, errors);
                }

                // Parse element url
                else if (atName == "url")
                {
                    result.UrlElement = FhirUriParser.ParseFhirUri(reader, errors);
                }

                // Parse element bodySite
                else if (atName == "bodySite")
                {
                    result.BodySite = CodingParser.ParseCoding(reader, errors);
                }

                // Parse element dateTime
                else if (atName == "dateTime")
                {
                    result.DateTimeElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors);
                }

                // Parse element instance
                else if (atName == "instance")
                {
                    result.Instance = new List <Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "instance"))
                    {
                        result.Instance.Add(ImagingStudyParser.ParseImagingStudySeriesInstanceComponent(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);
        }
コード例 #17
0
        /// <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);
        }
コード例 #18
0
        /// <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);
        }
コード例 #19
0
        /// <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);
        }
コード例 #20
0
        /// <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);
        }
コード例 #21
0
        /// <summary>
        /// Parse ImagingStudySeriesInstanceComponent
        /// </summary>
        public static Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent ParseImagingStudySeriesInstanceComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent existingInstance = null)
        {
            Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent();
            string currentElementName = reader.CurrentElementName;

            reader.EnterElement();

            while (reader.HasMoreElements())
            {
                var atName = reader.CurrentElementName;
                // Parse element extension
                if (atName == "extension")
                {
                    result.Extension = new List <Hl7.Fhir.Model.Extension>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "extension"))
                    {
                        result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element _id
                else if (atName == "_id")
                {
                    result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
                }

                // Parse element number
                else if (atName == "number")
                {
                    result.NumberElement = IntegerParser.ParseInteger(reader, errors);
                }

                // Parse element uid
                else if (atName == "uid")
                {
                    result.UidElement = OidParser.ParseOid(reader, errors);
                }

                // Parse element sopclass
                else if (atName == "sopclass")
                {
                    result.SopclassElement = OidParser.ParseOid(reader, errors);
                }

                // Parse element type
                else if (atName == "type")
                {
                    result.TypeElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element title
                else if (atName == "title")
                {
                    result.TitleElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element url
                else if (atName == "url")
                {
                    result.UrlElement = FhirUriParser.ParseFhirUri(reader, errors);
                }

                // Parse element attachment
                else if (atName == "attachment")
                {
                    result.Attachment = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                else
                {
                    errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
                    reader.SkipSubElementsFor(currentElementName);
                    result = null;
                }
            }

            reader.LeaveElement();
            return(result);
        }
コード例 #22
0
        /// <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);
        }
コード例 #23
0
        /// <summary>
        /// Parse Condition
        /// </summary>
        public static Hl7.Fhir.Model.Condition ParseCondition(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Condition existingInstance = null)
        {
            Hl7.Fhir.Model.Condition result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Condition();
            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 encounter
                else if (atName == "encounter")
                {
                    result.Encounter = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element asserter
                else if (atName == "asserter")
                {
                    result.Asserter = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element dateAsserted
                else if (atName == "dateAsserted")
                {
                    result.DateAssertedElement = DateParser.ParseDate(reader, errors);
                }

                // Parse element code
                else if (atName == "code")
                {
                    result.Code = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                }

                // Parse element category
                else if (atName == "category")
                {
                    result.Category = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                }

                // Parse element status
                else if (atName == "status")
                {
                    result.StatusElement = CodeParser.ParseCode <Hl7.Fhir.Model.Condition.ConditionStatus>(reader, errors);
                }

                // Parse element certainty
                else if (atName == "certainty")
                {
                    result.Certainty = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                }

                // Parse element severity
                else if (atName == "severity")
                {
                    result.Severity = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                }

                // Parse element onset
                else if (atName.StartsWith("onset"))
                {
                    result.Onset = FhirParser.ParseElement(reader, errors);
                }

                // Parse element abatement
                else if (atName.StartsWith("abatement"))
                {
                    result.Abatement = FhirParser.ParseElement(reader, errors);
                }

                // Parse element stage
                else if (atName == "stage")
                {
                    result.Stage = ConditionParser.ParseConditionStageComponent(reader, errors);
                }

                // Parse element evidence
                else if (atName == "evidence")
                {
                    result.Evidence = new List <Hl7.Fhir.Model.Condition.ConditionEvidenceComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "evidence"))
                    {
                        result.Evidence.Add(ConditionParser.ParseConditionEvidenceComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element location
                else if (atName == "location")
                {
                    result.Location = new List <Hl7.Fhir.Model.Condition.ConditionLocationComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "location"))
                    {
                        result.Location.Add(ConditionParser.ParseConditionLocationComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element relatedItem
                else if (atName == "relatedItem")
                {
                    result.RelatedItem = new List <Hl7.Fhir.Model.Condition.ConditionRelatedItemComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "relatedItem"))
                    {
                        result.RelatedItem.Add(ConditionParser.ParseConditionRelatedItemComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // 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);
        }
コード例 #24
0
        /// <summary>
        /// Parse ProtocolStepComponent
        /// </summary>
        public static Hl7.Fhir.Model.Protocol.ProtocolStepComponent ParseProtocolStepComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Protocol.ProtocolStepComponent existingInstance = null)
        {
            Hl7.Fhir.Model.Protocol.ProtocolStepComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Protocol.ProtocolStepComponent();
            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 name
                    else if (ParserUtils.IsAtFhirElement(reader, "name"))
                    {
                        result.Name = FhirStringParser.ParseFhirString(reader, errors);
                    }

                    // Parse element description
                    else if (ParserUtils.IsAtFhirElement(reader, "description"))
                    {
                        result.Description = FhirStringParser.ParseFhirString(reader, errors);
                    }

                    // Parse element duration
                    else if (ParserUtils.IsAtFhirElement(reader, "duration"))
                    {
                        result.Duration = DurationParser.ParseDuration(reader, errors);
                    }

                    // Parse element precondition
                    else if (ParserUtils.IsAtFhirElement(reader, "precondition"))
                    {
                        result.Precondition = ProtocolParser.ParseProtocolStepPreconditionComponent(reader, errors);
                    }

                    // Parse element exit
                    else if (ParserUtils.IsAtFhirElement(reader, "exit"))
                    {
                        result.Exit = ProtocolParser.ParseProtocolStepPreconditionComponent(reader, errors);
                    }

                    // Parse element firstActivity
                    else if (ParserUtils.IsAtFhirElement(reader, "firstActivity"))
                    {
                        result.FirstActivity = IdRefParser.ParseIdRef(reader, errors);
                    }

                    // Parse element activity
                    else if (ParserUtils.IsAtFhirElement(reader, "activity"))
                    {
                        result.Activity = new List <Hl7.Fhir.Model.Protocol.ProtocolStepActivityComponent>();
                        reader.EnterArray();

                        while (ParserUtils.IsAtArrayElement(reader, "activity"))
                        {
                            result.Activity.Add(ProtocolParser.ParseProtocolStepActivityComponent(reader, errors));
                        }

                        reader.LeaveArray();
                    }

                    // Parse element next
                    else if (ParserUtils.IsAtFhirElement(reader, "next"))
                    {
                        result.Next = new List <Hl7.Fhir.Model.Protocol.ProtocolStepNextComponent>();
                        reader.EnterArray();

                        while (ParserUtils.IsAtArrayElement(reader, "next"))
                        {
                            result.Next.Add(ProtocolParser.ParseProtocolStepNextComponent(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();
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message, reader);
            }
            return(result);
        }
コード例 #25
0
        /// <summary>
        /// Parse Device
        /// </summary>
        public static Hl7.Fhir.Model.Device ParseDevice(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Device existingInstance = null)
        {
            Hl7.Fhir.Model.Device result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Device();
            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 type
                else if (atName == "type")
                {
                    result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                }

                // Parse element manufacturer
                else if (atName == "manufacturer")
                {
                    result.ManufacturerElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element model
                else if (atName == "model")
                {
                    result.ModelElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element version
                else if (atName == "version")
                {
                    result.VersionElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element expiry
                else if (atName == "expiry")
                {
                    result.ExpiryElement = DateParser.ParseDate(reader, errors);
                }

                // Parse element identity
                else if (atName == "identity")
                {
                    result.Identity = DeviceParser.ParseDeviceIdentityComponent(reader, errors);
                }

                // Parse element owner
                else if (atName == "owner")
                {
                    result.Owner = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element assignedId
                else if (atName == "assignedId")
                {
                    result.AssignedId = new List <Hl7.Fhir.Model.Identifier>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "assignedId"))
                    {
                        result.AssignedId.Add(IdentifierParser.ParseIdentifier(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element location
                else if (atName == "location")
                {
                    result.Location = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element patient
                else if (atName == "patient")
                {
                    result.Patient = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element contact
                else if (atName == "contact")
                {
                    result.Contact = new List <Hl7.Fhir.Model.Contact>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "contact"))
                    {
                        result.Contact.Add(ContactParser.ParseContact(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element url
                else if (atName == "url")
                {
                    result.UrlElement = FhirUriParser.ParseFhirUri(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);
        }
コード例 #26
0
        /// <summary>
        /// Parse Protocol
        /// </summary>
        public static Hl7.Fhir.Model.Protocol ParseProtocol(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Protocol existingInstance = null)
        {
            Hl7.Fhir.Model.Protocol result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Protocol();
            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 title
                    else if (ParserUtils.IsAtFhirElement(reader, "title"))
                    {
                        result.Title = FhirStringParser.ParseFhirString(reader, errors);
                    }

                    // Parse element type
                    else if (ParserUtils.IsAtFhirElement(reader, "type"))
                    {
                        result.Type = CodeParser.ParseCode <Hl7.Fhir.Model.Protocol.ProtocolType>(reader, errors);
                    }

                    // Parse element status
                    else if (ParserUtils.IsAtFhirElement(reader, "status"))
                    {
                        result.Status = CodeParser.ParseCode <Hl7.Fhir.Model.Protocol.ProtocolStatus>(reader, errors);
                    }

                    // Parse element author
                    else if (ParserUtils.IsAtFhirElement(reader, "author"))
                    {
                        result.Author = ResourceReferenceParser.ParseResourceReference(reader, errors);
                    }

                    // Parse element purpose
                    else if (ParserUtils.IsAtFhirElement(reader, "purpose"))
                    {
                        result.Purpose = FhirStringParser.ParseFhirString(reader, errors);
                    }

                    // Parse element subject
                    else if (ParserUtils.IsAtFhirElement(reader, "subject"))
                    {
                        result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors);
                    }

                    // Parse element group
                    else if (ParserUtils.IsAtFhirElement(reader, "group"))
                    {
                        result.Group = ResourceReferenceParser.ParseResourceReference(reader, errors);
                    }

                    // Parse element step
                    else if (ParserUtils.IsAtFhirElement(reader, "step"))
                    {
                        result.Step = new List <Hl7.Fhir.Model.Protocol.ProtocolStepComponent>();
                        reader.EnterArray();

                        while (ParserUtils.IsAtArrayElement(reader, "step"))
                        {
                            result.Step.Add(ProtocolParser.ParseProtocolStepComponent(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();
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message, reader);
            }
            return(result);
        }
コード例 #27
0
        /// <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);
        }
コード例 #28
0
        /// <summary>
        /// Parse ImagingStudy
        /// </summary>
        public static Hl7.Fhir.Model.ImagingStudy ParseImagingStudy(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ImagingStudy existingInstance = null)
        {
            Hl7.Fhir.Model.ImagingStudy result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ImagingStudy();
            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 dateTime
                else if (atName == "dateTime")
                {
                    result.DateTimeElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors);
                }

                // Parse element subject
                else if (atName == "subject")
                {
                    result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element uid
                else if (atName == "uid")
                {
                    result.UidElement = OidParser.ParseOid(reader, errors);
                }

                // Parse element accessionNo
                else if (atName == "accessionNo")
                {
                    result.AccessionNo = IdentifierParser.ParseIdentifier(reader, errors);
                }

                // 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 modality
                else if (atName == "modality")
                {
                    result.Modality_Element = new List <Code <Hl7.Fhir.Model.ImagingStudy.ImagingModality> >();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "modality"))
                    {
                        result.Modality_Element.Add(CodeParser.ParseCode <Hl7.Fhir.Model.ImagingStudy.ImagingModality>(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element referrer
                else if (atName == "referrer")
                {
                    result.Referrer = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element availability
                else if (atName == "availability")
                {
                    result.AvailabilityElement = CodeParser.ParseCode <Hl7.Fhir.Model.ImagingStudy.InstanceAvailability>(reader, errors);
                }

                // Parse element url
                else if (atName == "url")
                {
                    result.UrlElement = FhirUriParser.ParseFhirUri(reader, errors);
                }

                // Parse element numberOfSeries
                else if (atName == "numberOfSeries")
                {
                    result.NumberOfSeriesElement = IntegerParser.ParseInteger(reader, errors);
                }

                // Parse element numberOfInstances
                else if (atName == "numberOfInstances")
                {
                    result.NumberOfInstancesElement = IntegerParser.ParseInteger(reader, errors);
                }

                // Parse element clinicalInformation
                else if (atName == "clinicalInformation")
                {
                    result.ClinicalInformationElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element procedure
                else if (atName == "procedure")
                {
                    result.Procedure = new List <Hl7.Fhir.Model.Coding>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "procedure"))
                    {
                        result.Procedure.Add(CodingParser.ParseCoding(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element interpreter
                else if (atName == "interpreter")
                {
                    result.Interpreter = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element description
                else if (atName == "description")
                {
                    result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors);
                }

                // Parse element series
                else if (atName == "series")
                {
                    result.Series = new List <Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "series"))
                    {
                        result.Series.Add(ImagingStudyParser.ParseImagingStudySeriesComponent(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);
        }
コード例 #29
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);
        }
コード例 #30
0
        /// <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);
        }