コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
0
        /// <summary>
        /// Parse XdsEntry
        /// </summary>
        public static XdsEntry ParseXdsEntry(IFhirReader reader, ErrorList errors, XdsEntry existingInstance = null)
        {
            XdsEntry result = existingInstance != null ? existingInstance : new XdsEntry();

            try
            {
                string currentElementName = reader.CurrentElementName;
                reader.EnterElement();

                while (reader.HasMoreElements())
                {
                    // Parse element extension
                    if (ParserUtils.IsAtFhirElement(reader, "extension"))
                    {
                        result.Extension = new List <Extension>();
                        reader.EnterArray();

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

                        reader.LeaveArray();
                    }

                    // Parse element language
                    else if (ParserUtils.IsAtFhirElement(reader, "language"))
                    {
                        result.Language = CodeParser.ParseCode(reader, errors);
                    }

                    // Parse element text
                    else if (ParserUtils.IsAtFhirElement(reader, "text"))
                    {
                        result.Text = NarrativeParser.ParseNarrative(reader, errors);
                    }

                    // Parse element contained
                    else if (ParserUtils.IsAtFhirElement(reader, "contained"))
                    {
                        result.Contained = new List <Resource>();
                        reader.EnterArray();

                        while (ParserUtils.IsAtArrayElement(reader, "contained"))
                        {
                            result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors));
                        }

                        reader.LeaveArray();
                    }

                    // Parse element internalId
                    else if (reader.IsAtRefIdElement())
                    {
                        result.InternalId = Id.Parse(reader.ReadRefIdContents());
                    }

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

                    // Parse element repositoryId
                    else if (ParserUtils.IsAtFhirElement(reader, "repositoryId"))
                    {
                        result.RepositoryId = FhirUriParser.ParseFhirUri(reader, errors);
                    }

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

                    // Parse element format
                    else if (ParserUtils.IsAtFhirElement(reader, "format"))
                    {
                        result.Format = CodingParser.ParseCoding(reader, errors);
                    }

                    // Parse element class
                    else if (ParserUtils.IsAtFhirElement(reader, "class"))
                    {
                        result.Class = CodingParser.ParseCoding(reader, errors);
                    }

                    // Parse element type
                    else if (ParserUtils.IsAtFhirElement(reader, "type"))
                    {
                        result.Type = CodingParser.ParseCoding(reader, errors);
                    }

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

                    // Parse element documentId
                    else if (ParserUtils.IsAtFhirElement(reader, "documentId"))
                    {
                        result.DocumentId = FhirUriParser.ParseFhirUri(reader, errors);
                    }

                    // Parse element availability
                    else if (ParserUtils.IsAtFhirElement(reader, "availability"))
                    {
                        result.Availability = CodeParser.ParseCode <XdsEntry.XdsEntryAvailability>(reader, errors);
                    }

                    // Parse element confidentialityCode
                    else if (ParserUtils.IsAtFhirElement(reader, "confidentialityCode"))
                    {
                        result.ConfidentialityCode = CodingParser.ParseCoding(reader, errors);
                    }

                    // Parse element created
                    else if (ParserUtils.IsAtFhirElement(reader, "created"))
                    {
                        result.Created = InstantParser.ParseInstant(reader, errors);
                    }

                    // Parse element event
                    else if (ParserUtils.IsAtFhirElement(reader, "event"))
                    {
                        result.Event = new List <Coding>();
                        reader.EnterArray();

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

                        reader.LeaveArray();
                    }

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

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

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

                    // Parse element folder
                    else if (ParserUtils.IsAtFhirElement(reader, "folder"))
                    {
                        result.Folder = new List <ResourceReference>();
                        reader.EnterArray();

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

                        reader.LeaveArray();
                    }

                    // Parse element patientId
                    else if (ParserUtils.IsAtFhirElement(reader, "patientId"))
                    {
                        result.PatientId = IdentifierParser.ParseIdentifier(reader, errors);
                    }

                    // Parse element sourcePatientId
                    else if (ParserUtils.IsAtFhirElement(reader, "sourcePatientId"))
                    {
                        result.SourcePatientId = IdentifierParser.ParseIdentifier(reader, errors);
                    }

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

                    // Parse element author
                    else if (ParserUtils.IsAtFhirElement(reader, "author"))
                    {
                        result.Author = new List <XdsEntry.XdsEntryAuthorComponent>();
                        reader.EnterArray();

                        while (ParserUtils.IsAtArrayElement(reader, "author"))
                        {
                            result.Author.Add(XdsEntryParser.ParseXdsEntryAuthorComponent(reader, errors));
                        }

                        reader.LeaveArray();
                    }

                    // Parse element authenticator
                    else if (ParserUtils.IsAtFhirElement(reader, "authenticator"))
                    {
                        result.Authenticator = XdsEntryParser.ParseXdsEntryAuthenticatorComponent(reader, errors);
                    }

                    // Parse element facilityType
                    else if (ParserUtils.IsAtFhirElement(reader, "facilityType"))
                    {
                        result.FacilityType = CodingParser.ParseCoding(reader, errors);
                    }

                    // Parse element practiceSetting
                    else if (ParserUtils.IsAtFhirElement(reader, "practiceSetting"))
                    {
                        result.PracticeSetting = CodingParser.ParseCoding(reader, errors);
                    }

                    // Parse element homeCommunity
                    else if (ParserUtils.IsAtFhirElement(reader, "homeCommunity"))
                    {
                        result.HomeCommunity = FhirUriParser.ParseFhirUri(reader, errors);
                    }

                    // Parse element service
                    else if (ParserUtils.IsAtFhirElement(reader, "service"))
                    {
                        result.Service = XdsEntryParser.ParseXdsEntryServiceComponent(reader, errors);
                    }

                    // Parse element comments
                    else if (ParserUtils.IsAtFhirElement(reader, "comments"))
                    {
                        result.Comments = 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);
        }
コード例 #4
0
        /// <summary>
        /// Parse XdsEntry2
        /// </summary>
        public static XdsEntry2 ParseXdsEntry2(IFhirReader reader, ErrorList errors, XdsEntry2 existingInstance = null)
        {
            XdsEntry2 result = existingInstance != null ? existingInstance : new XdsEntry2();

            try
            {
                string currentElementName = reader.CurrentElementName;
                reader.EnterElement();

                while (reader.HasMoreElements())
                {
                    // Parse element extension
                    if (ParserUtils.IsAtFhirElement(reader, "extension"))
                    {
                        result.Extension = new List <Extension>();
                        reader.EnterArray();

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

                        reader.LeaveArray();
                    }

                    // Parse element language
                    else if (ParserUtils.IsAtFhirElement(reader, "language"))
                    {
                        result.Language = CodeParser.ParseCode(reader, errors);
                    }

                    // Parse element text
                    else if (ParserUtils.IsAtFhirElement(reader, "text"))
                    {
                        result.Text = NarrativeParser.ParseNarrative(reader, errors);
                    }

                    // Parse element contained
                    else if (ParserUtils.IsAtFhirElement(reader, "contained"))
                    {
                        result.Contained = new List <Resource>();
                        reader.EnterArray();

                        while (ParserUtils.IsAtArrayElement(reader, "contained"))
                        {
                            result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors));
                        }

                        reader.LeaveArray();
                    }

                    // Parse element internalId
                    else if (reader.IsAtRefIdElement())
                    {
                        result.InternalId = Id.Parse(reader.ReadRefIdContents());
                    }

                    // Parse element id
                    else if (ParserUtils.IsAtFhirElement(reader, "id"))
                    {
                        result.Id = IdentifierParser.ParseIdentifier(reader, errors);
                    }

                    // Parse element information
                    else if (ParserUtils.IsAtFhirElement(reader, "information"))
                    {
                        result.Information = DocumentInformationParser.ParseDocumentInformation(reader, errors);
                    }

                    // Parse element format
                    else if (ParserUtils.IsAtFhirElement(reader, "format"))
                    {
                        result.Format = CodingParser.ParseCoding(reader, errors);
                    }

                    // Parse element availability
                    else if (ParserUtils.IsAtFhirElement(reader, "availability"))
                    {
                        result.Availability = CodeParser.ParseCode(reader, errors);
                    }

                    // Parse element folder
                    else if (ParserUtils.IsAtFhirElement(reader, "folder"))
                    {
                        result.Folder = new List <ResourceReference>();
                        reader.EnterArray();

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

                        reader.LeaveArray();
                    }

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

                    // Parse element content
                    else if (ParserUtils.IsAtFhirElement(reader, "content"))
                    {
                        result.Content = AttachmentParser.ParseAttachment(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);
        }
コード例 #5
0
        /// <summary>
        /// Parse DocumentInformation
        /// </summary>
        public static DocumentInformation ParseDocumentInformation(IFhirReader reader, ErrorList errors, DocumentInformation existingInstance = null)
        {
            DocumentInformation result = existingInstance != null ? existingInstance : new DocumentInformation();

            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 versionId
                    else if (ParserUtils.IsAtFhirElement(reader, "versionId"))
                    {
                        result.VersionId = IdentifierParser.ParseIdentifier(reader, errors);
                    }

                    // Parse element created
                    else if (ParserUtils.IsAtFhirElement(reader, "created"))
                    {
                        result.Created = InstantParser.ParseInstant(reader, errors);
                    }

                    // Parse element class
                    else if (ParserUtils.IsAtFhirElement(reader, "class"))
                    {
                        result.Class = CodingParser.ParseCoding(reader, errors);
                    }

                    // Parse element type
                    else if (ParserUtils.IsAtFhirElement(reader, "type"))
                    {
                        result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                    }

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

                    // Parse element confidentiality
                    else if (ParserUtils.IsAtFhirElement(reader, "confidentiality"))
                    {
                        result.Confidentiality = CodingParser.ParseCoding(reader, errors);
                    }

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

                    // Parse element author
                    else if (ParserUtils.IsAtFhirElement(reader, "author"))
                    {
                        result.Author = new List <ResourceReference>();
                        reader.EnterArray();

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

                        reader.LeaveArray();
                    }

                    // Parse element attester
                    else if (ParserUtils.IsAtFhirElement(reader, "attester"))
                    {
                        result.Attester = new List <DocumentInformation.DocumentInformationAttesterComponent>();
                        reader.EnterArray();

                        while (ParserUtils.IsAtArrayElement(reader, "attester"))
                        {
                            result.Attester.Add(DocumentInformationParser.ParseDocumentInformationAttesterComponent(reader, errors));
                        }

                        reader.LeaveArray();
                    }

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

                    // Parse element event
                    else if (ParserUtils.IsAtFhirElement(reader, "event"))
                    {
                        result.Event = DocumentInformationParser.ParseDocumentInformationEventComponent(reader, errors);
                    }

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

                    // Parse element facilityType
                    else if (ParserUtils.IsAtFhirElement(reader, "facilityType"))
                    {
                        result.FacilityType = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                    }

                    // Parse element practiceSetting
                    else if (ParserUtils.IsAtFhirElement(reader, "practiceSetting"))
                    {
                        result.PracticeSetting = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                    }

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

                reader.LeaveElement();
            }
            catch (Exception ex)
            {
                errors.Add(ex.Message, reader);
            }
            return(result);
        }
コード例 #6
0
        /// <summary>
        /// Parse XdsFolder
        /// </summary>
        public static XdsFolder ParseXdsFolder(IFhirReader reader, ErrorList errors, XdsFolder existingInstance = null)
        {
            XdsFolder result = existingInstance != null ? existingInstance : new XdsFolder();

            try
            {
                string currentElementName = reader.CurrentElementName;
                reader.EnterElement();

                while (reader.HasMoreElements())
                {
                    // Parse element extension
                    if (ParserUtils.IsAtFhirElement(reader, "extension"))
                    {
                        result.Extension = new List <Extension>();
                        reader.EnterArray();

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

                        reader.LeaveArray();
                    }

                    // Parse element language
                    else if (ParserUtils.IsAtFhirElement(reader, "language"))
                    {
                        result.Language = CodeParser.ParseCode(reader, errors);
                    }

                    // Parse element text
                    else if (ParserUtils.IsAtFhirElement(reader, "text"))
                    {
                        result.Text = NarrativeParser.ParseNarrative(reader, errors);
                    }

                    // Parse element contained
                    else if (ParserUtils.IsAtFhirElement(reader, "contained"))
                    {
                        result.Contained = new List <Resource>();
                        reader.EnterArray();

                        while (ParserUtils.IsAtArrayElement(reader, "contained"))
                        {
                            result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors));
                        }

                        reader.LeaveArray();
                    }

                    // Parse element internalId
                    else if (reader.IsAtRefIdElement())
                    {
                        result.InternalId = Id.Parse(reader.ReadRefIdContents());
                    }

                    // Parse element code
                    else if (ParserUtils.IsAtFhirElement(reader, "code"))
                    {
                        result.Code = new List <Coding>();
                        reader.EnterArray();

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

                        reader.LeaveArray();
                    }

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

                    // Parse element patientId
                    else if (ParserUtils.IsAtFhirElement(reader, "patientId"))
                    {
                        result.PatientId = IdentifierParser.ParseIdentifier(reader, errors);
                    }

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

                    // Parse element comments
                    else if (ParserUtils.IsAtFhirElement(reader, "comments"))
                    {
                        result.Comments = 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 Document
        /// </summary>
        public static Hl7.Fhir.Model.Document ParseDocument(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Document existingInstance = null)
        {
            Hl7.Fhir.Model.Document result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Document();
            string currentElementName      = reader.CurrentElementName;

            reader.EnterElement();

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

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

                    reader.LeaveArray();
                }

                // Parse element language
                else if (atName == "language")
                {
                    result.LanguageElement = CodeParser.ParseCode(reader, errors);
                }

                // Parse element text
                else if (atName == "text")
                {
                    result.Text = NarrativeParser.ParseNarrative(reader, errors);
                }

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

                    while (ParserUtils.IsAtArrayElement(reader, "contained"))
                    {
                        result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors));
                    }

                    reader.LeaveArray();
                }

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

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

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

                // Parse element created
                else if (atName == "created")
                {
                    result.CreatedElement = InstantParser.ParseInstant(reader, errors);
                }

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

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

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

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

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

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

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

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

                    reader.LeaveArray();
                }

                // Parse element attester
                else if (atName == "attester")
                {
                    result.Attester = new List <Hl7.Fhir.Model.Document.DocumentAttesterComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "attester"))
                    {
                        result.Attester.Add(DocumentParser.ParseDocumentAttesterComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

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

                // Parse element event
                else if (atName == "event")
                {
                    result.Event = DocumentParser.ParseDocumentEventComponent(reader, errors);
                }

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

                // Parse element replaces
                else if (atName == "replaces")
                {
                    result.ReplacesElement = IdParser.ParseId(reader, errors);
                }

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

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

                    reader.LeaveArray();
                }

                // Parse element stylesheet
                else if (atName == "stylesheet")
                {
                    result.Stylesheet = AttachmentParser.ParseAttachment(reader, errors);
                }

                // Parse element representation
                else if (atName == "representation")
                {
                    result.Representation = AttachmentParser.ParseAttachment(reader, errors);
                }

                // Parse element section
                else if (atName == "section")
                {
                    result.Section = new List <Hl7.Fhir.Model.Document.SectionComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "section"))
                    {
                        result.Section.Add(DocumentParser.ParseSectionComponent(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);
        }
コード例 #8
0
        /// <summary>
        /// Parse ProvenanceEntityComponent
        /// </summary>
        public static Hl7.Fhir.Model.Provenance.ProvenanceEntityComponent ParseProvenanceEntityComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Provenance.ProvenanceEntityComponent existingInstance = null)
        {
            Hl7.Fhir.Model.Provenance.ProvenanceEntityComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Provenance.ProvenanceEntityComponent();
            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 role
                else if (atName == "role")
                {
                    result.RoleElement = CodeParser.ParseCode <Hl7.Fhir.Model.Provenance.ProvenanceEntityRole>(reader, errors);
                }

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

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

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

                // Parse element agent
                else if (atName == "agent")
                {
                    result.Agent = ProvenanceParser.ParseProvenanceAgentComponent(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 Profile
        /// </summary>
        public static Hl7.Fhir.Model.Profile ParseProfile(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Profile existingInstance = null)
        {
            Hl7.Fhir.Model.Profile result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Profile();
            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 code
                else if (atName == "code")
                {
                    result.Code = new List <Hl7.Fhir.Model.Coding>();
                    reader.EnterArray();

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

                    reader.LeaveArray();
                }

                // Parse element status
                else if (atName == "status")
                {
                    result.StatusElement = CodeParser.ParseCode <Hl7.Fhir.Model.Profile.ResourceProfileStatus>(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 fhirVersion
                else if (atName == "fhirVersion")
                {
                    result.FhirVersionElement = IdParser.ParseId(reader, errors);
                }

                // Parse element structure
                else if (atName == "structure")
                {
                    result.Structure = new List <Hl7.Fhir.Model.Profile.ProfileStructureComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "structure"))
                    {
                        result.Structure.Add(ProfileParser.ParseProfileStructureComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element extensionDefn
                else if (atName == "extensionDefn")
                {
                    result.ExtensionDefn = new List <Hl7.Fhir.Model.Profile.ProfileExtensionDefnComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "extensionDefn"))
                    {
                        result.ExtensionDefn.Add(ProfileParser.ParseProfileExtensionDefnComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element binding
                else if (atName == "binding")
                {
                    result.Binding = new List <Hl7.Fhir.Model.Profile.ProfileBindingComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "binding"))
                    {
                        result.Binding.Add(ProfileParser.ParseProfileBindingComponent(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);
        }
コード例 #10
0
        /// <summary>
        /// Parse CodeableConcept
        /// </summary>
        public static Hl7.Fhir.Model.CodeableConcept ParseCodeableConcept(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.CodeableConcept existingInstance = null)
        {
            Hl7.Fhir.Model.CodeableConcept result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.CodeableConcept();
            string currentElementName             = reader.CurrentElementName;

            reader.EnterElement();

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

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

                    reader.LeaveArray();
                }

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

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

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

                    reader.LeaveArray();
                }

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

                // Parse element primary
                else if (atName == "primary")
                {
                    result.PrimaryElement = IdRefParser.ParseIdRef(reader, errors);
                }

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

            reader.LeaveElement();
            return(result);
        }
コード例 #11
0
        /// <summary>
        /// Parse QuestionComponent
        /// </summary>
        public static Hl7.Fhir.Model.Questionnaire.QuestionComponent ParseQuestionComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Questionnaire.QuestionComponent existingInstance = null)
        {
            Hl7.Fhir.Model.Questionnaire.QuestionComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Questionnaire.QuestionComponent();
            string currentElementName = reader.CurrentElementName;

            reader.EnterElement();

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

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

                    reader.LeaveArray();
                }

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

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

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

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

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

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

                    reader.LeaveArray();
                }

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

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

                // Parse element remarks
                else if (atName == "remarks")
                {
                    result.RemarksElement = 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);
        }
コード例 #12
0
        /// <summary>
        /// Parse SecurityEventParticipantComponent
        /// </summary>
        public static Hl7.Fhir.Model.SecurityEvent.SecurityEventParticipantComponent ParseSecurityEventParticipantComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.SecurityEvent.SecurityEventParticipantComponent existingInstance = null)
        {
            Hl7.Fhir.Model.SecurityEvent.SecurityEventParticipantComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.SecurityEvent.SecurityEventParticipantComponent();
            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 role
                else if (atName == "role")
                {
                    result.Role = new List <Hl7.Fhir.Model.CodeableConcept>();
                    reader.EnterArray();

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

                    reader.LeaveArray();
                }

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

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

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

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

                // Parse element requestor
                else if (atName == "requestor")
                {
                    result.RequestorElement = FhirBooleanParser.ParseFhirBoolean(reader, errors);
                }

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

                // Parse element network
                else if (atName == "network")
                {
                    result.Network = SecurityEventParser.ParseSecurityEventParticipantNetworkComponent(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);
        }
コード例 #13
0
        /// <summary>
        /// Parse SecurityEventSourceComponent
        /// </summary>
        public static Hl7.Fhir.Model.SecurityEvent.SecurityEventSourceComponent ParseSecurityEventSourceComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.SecurityEvent.SecurityEventSourceComponent existingInstance = null)
        {
            Hl7.Fhir.Model.SecurityEvent.SecurityEventSourceComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.SecurityEvent.SecurityEventSourceComponent();
            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 site
                else if (atName == "site")
                {
                    result.SiteElement = FhirStringParser.ParseFhirString(reader, errors);
                }

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

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

                    while (ParserUtils.IsAtArrayElement(reader, "type"))
                    {
                        result.Type.Add(CodingParser.ParseCoding(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);
        }
コード例 #14
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);
        }
コード例 #15
0
        /// <summary>
        /// Parse OperationOutcomeIssueComponent
        /// </summary>
        public static Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent ParseOperationOutcomeIssueComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent existingInstance = null)
        {
            Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent();
            string currentElementName = reader.CurrentElementName;

            reader.EnterElement();

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

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

                    reader.LeaveArray();
                }

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

                // Parse element severity
                else if (atName == "severity")
                {
                    result.SeverityElement = CodeParser.ParseCode <Hl7.Fhir.Model.OperationOutcome.IssueSeverity>(reader, errors);
                }

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

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

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

                    while (ParserUtils.IsAtArrayElement(reader, "location"))
                    {
                        result.LocationElement.Add(FhirStringParser.ParseFhirString(reader, errors));
                    }

                    reader.LeaveArray();
                }

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

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

                // Parse element period
                else if (atName == "period")
                {
                    result.Period = PeriodParser.ParsePeriod(reader, errors);
                }

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

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

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

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

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

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

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

                // Parse element subscriber
                else if (atName == "subscriber")
                {
                    result.Subscriber = CoverageParser.ParseCoverageSubscriberComponent(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);
        }
コード例 #17
0
        internal static Element ParseElement(IFhirReader reader, ErrorList errors)
        {
            try
            {
                reader.MoveToContent();

                if (ParserUtils.IsAtFhirElementEndingWith(reader, "Age"))
                {
                    return(AgeParser.ParseAge(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Count"))
                {
                    return(CountParser.ParseCount(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Distance"))
                {
                    return(DistanceParser.ParseDistance(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Duration"))
                {
                    return(DurationParser.ParseDuration(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Money"))
                {
                    return(MoneyParser.ParseMoney(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Address"))
                {
                    return(AddressParser.ParseAddress(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Attachment"))
                {
                    return(AttachmentParser.ParseAttachment(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Choice"))
                {
                    return(ChoiceParser.ParseChoice(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "CodeableConcept"))
                {
                    return(CodeableConceptParser.ParseCodeableConcept(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Coding"))
                {
                    return(CodingParser.ParseCoding(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Contact"))
                {
                    return(ContactParser.ParseContact(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Extension"))
                {
                    return(ExtensionParser.ParseExtension(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "HumanName"))
                {
                    return(HumanNameParser.ParseHumanName(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Identifier"))
                {
                    return(IdentifierParser.ParseIdentifier(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Narrative"))
                {
                    return(NarrativeParser.ParseNarrative(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Period"))
                {
                    return(PeriodParser.ParsePeriod(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Quantity"))
                {
                    return(QuantityParser.ParseQuantity(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Range"))
                {
                    return(RangeParser.ParseRange(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Ratio"))
                {
                    return(RatioParser.ParseRatio(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Resource"))
                {
                    return(ResourceReferenceParser.ParseResourceReference(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "SampledData"))
                {
                    return(SampledDataParser.ParseSampledData(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Schedule"))
                {
                    return(ScheduleParser.ParseSchedule(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Base64Binary"))
                {
                    return(Base64BinaryParser.ParseBase64Binary(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Boolean"))
                {
                    return(FhirBooleanParser.ParseFhirBoolean(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Code"))
                {
                    return(CodeParser.ParseCode(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Date"))
                {
                    return(DateParser.ParseDate(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "DateTime"))
                {
                    return(FhirDateTimeParser.ParseFhirDateTime(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Decimal"))
                {
                    return(FhirDecimalParser.ParseFhirDecimal(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Id"))
                {
                    return(IdParser.ParseId(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Idref"))
                {
                    return(IdRefParser.ParseIdRef(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Instant"))
                {
                    return(InstantParser.ParseInstant(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Integer"))
                {
                    return(IntegerParser.ParseInteger(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Oid"))
                {
                    return(OidParser.ParseOid(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "String"))
                {
                    return(FhirStringParser.ParseFhirString(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Uri"))
                {
                    return(FhirUriParser.ParseFhirUri(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Uuid"))
                {
                    return(UuidParser.ParseUuid(reader, errors));
                }
                else if (ParserUtils.IsAtFhirElementEndingWith(reader, "Xhtml"))
                {
                    return(XHtmlParser.ParseXHtml(reader, errors));
                }
                else
                {
                    errors.Add(String.Format("Encountered unrecognized datatype '{0}'", reader.CurrentElementName), reader);
                    reader.SkipSubElementsFor(reader.CurrentElementName);
                    return(null);
                }
            }
            catch (Exception xe)
            {
                errors.Add(xe.Message, reader);
                return(null);
            }
        }