/// <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); }
/// <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); }
/// <summary> /// Parse ActivityDefinition /// </summary> public static Hl7.Fhir.Model.ActivityDefinition ParseActivityDefinition(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ActivityDefinition existingInstance = null) { Hl7.Fhir.Model.ActivityDefinition result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ActivityDefinition(); 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 category else if (ParserUtils.IsAtFhirElement(reader, "category")) { result.Category = CodeParser.ParseCode <Hl7.Fhir.Model.ActivityDefinition.ActivityDefinitionCategory>(reader, errors); } // Parse element code else if (ParserUtils.IsAtFhirElement(reader, "code")) { result.Code = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element timing else if (ParserUtils.IsAtFhirElement(reader, "timing", true)) { result.Timing = FhirParser.ParseElement(reader, errors); } // Parse element location else if (ParserUtils.IsAtFhirElement(reader, "location")) { result.Location = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element performer else if (ParserUtils.IsAtFhirElement(reader, "performer")) { result.Performer = new List <Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "performer")) { result.Performer.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } // Parse element product else if (ParserUtils.IsAtFhirElement(reader, "product")) { result.Product = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element quantity else if (ParserUtils.IsAtFhirElement(reader, "quantity")) { result.Quantity = QuantityParser.ParseQuantity(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); }
/// <summary> /// Parse OperationOutcomeIssueComponent /// </summary> public static Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent ParseOperationOutcomeIssueComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent existingInstance = null) { Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.OperationOutcome.OperationOutcomeIssueComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element severity else if (atName == "severity") { result.SeverityElement = CodeParser.ParseCode <Hl7.Fhir.Model.OperationOutcome.IssueSeverity>(reader, errors); } // Parse element type else if (atName == "type") { result.Type = CodingParser.ParseCoding(reader, errors); } // Parse element details else if (atName == "details") { result.DetailsElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element location else if (atName == "location") { result.LocationElement = new List <Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "location")) { result.LocationElement.Add(FhirStringParser.ParseFhirString(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse Substance /// </summary> public static Hl7.Fhir.Model.Substance ParseSubstance(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Substance existingInstance = null) { Hl7.Fhir.Model.Substance result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Substance(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (atName == "language") { result.LanguageElement = CodeParser.ParseCode(reader, errors); } // Parse element text else if (atName == "text") { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (atName == "contained") { result.Contained = new List <Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element identifier else if (atName == "identifier") { result.Identifier = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element name else if (atName == "name") { result.NameElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element type else if (atName == "type") { result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element description else if (atName == "description") { result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element status else if (atName == "status") { result.Status = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element effectiveTime else if (atName == "effectiveTime") { result.EffectiveTime = PeriodParser.ParsePeriod(reader, errors); } // Parse element quantity else if (atName == "quantity") { result.Quantity = QuantityParser.ParseQuantity(reader, errors); } // Parse element ingredient else if (atName == "ingredient") { result.Ingredient = new List <Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "ingredient")) { result.Ingredient.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } // Parse element quantityMode else if (atName == "quantityMode") { result.QuantityMode = CodeableConceptParser.ParseCodeableConcept(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse ValueSet /// </summary> public static Hl7.Fhir.Model.ValueSet ParseValueSet(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ValueSet existingInstance = null) { Hl7.Fhir.Model.ValueSet result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ValueSet(); 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 copyright else if (atName == "copyright") { result.CopyrightElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element status else if (atName == "status") { result.StatusElement = CodeParser.ParseCode <Hl7.Fhir.Model.ValueSet.ValueSetStatus>(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 define else if (atName == "define") { result.Define = ValueSetParser.ParseValueSetDefineComponent(reader, errors); } // Parse element compose else if (atName == "compose") { result.Compose = ValueSetParser.ParseValueSetComposeComponent(reader, errors); } // Parse element expansion else if (atName == "expansion") { result.Expansion = ValueSetParser.ParseValueSetExpansionComponent(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse 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); }
/// <summary> /// Parse Alert /// </summary> public static Hl7.Fhir.Model.Alert ParseAlert(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Alert existingInstance = null) { Hl7.Fhir.Model.Alert result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Alert(); 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 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.Alert.AlertStatus>(reader, errors); } // Parse element subject else if (atName == "subject") { result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element author else if (atName == "author") { result.Author = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element note else if (atName == "note") { result.NoteElement = FhirStringParser.ParseFhirString(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse Category /// </summary> public static Category ParseCategory(IFhirReader reader, ErrorList errors, Category existingInstance = null) { Category result = existingInstance != null ? existingInstance : new Category(); 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 <CodeableConcept>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "code")) { result.Code.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); } reader.LeaveArray(); } // Parse element title else if (ParserUtils.IsAtFhirElement(reader, "title")) { result.Title = FhirStringParser.ParseFhirString(reader, errors); } // Parse element subject else if (ParserUtils.IsAtFhirElement(reader, "subject")) { result.Subject = 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(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse IssueReportIssueComponent /// </summary> public static IssueReport.IssueReportIssueComponent ParseIssueReportIssueComponent(IFhirReader reader, ErrorList errors, IssueReport.IssueReportIssueComponent existingInstance = null) { IssueReport.IssueReportIssueComponent result = existingInstance != null ? existingInstance : new IssueReport.IssueReportIssueComponent(); 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 severity else if (ParserUtils.IsAtFhirElement(reader, "severity")) { result.Severity = CodeParser.ParseCode <IssueReport.IssueSeverity>(reader, errors); } // Parse element type else if (ParserUtils.IsAtFhirElement(reader, "type")) { result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element details else if (ParserUtils.IsAtFhirElement(reader, "details")) { result.Details = FhirStringParser.ParseFhirString(reader, errors); } // Parse element location else if (ParserUtils.IsAtFhirElement(reader, "location")) { result.Location = new List <FhirString>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "location")) { result.Location.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(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse Picture /// </summary> public static Hl7.Fhir.Model.Picture ParsePicture(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Picture existingInstance = null) { Hl7.Fhir.Model.Picture result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Picture(); 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 dateTime else if (atName == "dateTime") { result.DateTimeElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element operator else if (atName == "operator") { result.Operator = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element identifier else if (atName == "identifier") { result.Identifier = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element accessionNo else if (atName == "accessionNo") { result.AccessionNo = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element studyId else if (atName == "studyId") { result.StudyId = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element seriesId else if (atName == "seriesId") { result.SeriesId = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element method else if (atName == "method") { result.Method = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element requester else if (atName == "requester") { result.Requester = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element modality else if (atName == "modality") { result.ModalityElement = CodeParser.ParseCode <Hl7.Fhir.Model.Picture.PictureType>(reader, errors); } // Parse element deviceName else if (atName == "deviceName") { result.DeviceNameElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element height else if (atName == "height") { result.HeightElement = IntegerParser.ParseInteger(reader, errors); } // Parse element width else if (atName == "width") { result.WidthElement = IntegerParser.ParseInteger(reader, errors); } // Parse element bits else if (atName == "bits") { result.BitsElement = IntegerParser.ParseInteger(reader, errors); } // Parse element frames else if (atName == "frames") { result.FramesElement = IntegerParser.ParseInteger(reader, errors); } // Parse element frameDelay else if (atName == "frameDelay") { result.FrameDelay = DurationParser.ParseDuration(reader, errors); } // Parse element view else if (atName == "view") { result.View = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element content else if (atName == "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(); return(result); }
/// <summary> /// Parse DocumentReference /// </summary> public static Hl7.Fhir.Model.DocumentReference ParseDocumentReference(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.DocumentReference existingInstance = null) { Hl7.Fhir.Model.DocumentReference result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.DocumentReference(); 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 masterIdentifier else if (atName == "masterIdentifier") { result.MasterIdentifier = 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 subject else if (atName == "subject") { result.Subject = ResourceReferenceParser.ParseResourceReference(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 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 custodian else if (atName == "custodian") { result.Custodian = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element authenticator else if (atName == "authenticator") { result.Authenticator = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element created else if (atName == "created") { result.CreatedElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element indexed else if (atName == "indexed") { result.IndexedElement = InstantParser.ParseInstant(reader, errors); } // Parse element status else if (atName == "status") { result.StatusElement = CodeParser.ParseCode <Hl7.Fhir.Model.DocumentReference.DocumentReferenceStatus>(reader, errors); } // Parse element docStatus else if (atName == "docStatus") { result.DocStatus = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element supercedes else if (atName == "supercedes") { result.Supercedes = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element description else if (atName == "description") { result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element confidentiality else if (atName == "confidentiality") { result.Confidentiality = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element primaryLanguage else if (atName == "primaryLanguage") { result.PrimaryLanguageElement = CodeParser.ParseCode(reader, errors); } // Parse element mimeType else if (atName == "mimeType") { result.MimeTypeElement = CodeParser.ParseCode(reader, errors); } // Parse element format else if (atName == "format") { result.Format = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element size else if (atName == "size") { result.SizeElement = IntegerParser.ParseInteger(reader, errors); } // Parse element hash else if (atName == "hash") { result.HashElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element location else if (atName == "location") { result.LocationElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element service else if (atName == "service") { result.Service = DocumentReferenceParser.ParseDocumentReferenceServiceComponent(reader, errors); } // Parse element context else if (atName == "context") { result.Context = DocumentReferenceParser.ParseDocumentReferenceContextComponent(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse DocumentReferenceServiceComponent /// </summary> public static Hl7.Fhir.Model.DocumentReference.DocumentReferenceServiceComponent ParseDocumentReferenceServiceComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.DocumentReference.DocumentReferenceServiceComponent existingInstance = null) { Hl7.Fhir.Model.DocumentReference.DocumentReferenceServiceComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.DocumentReference.DocumentReferenceServiceComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element type else if (atName == "type") { result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element address else if (atName == "address") { result.AddressElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element parameter else if (atName == "parameter") { result.Parameter = new List <Hl7.Fhir.Model.DocumentReference.DocumentReferenceServiceParameterComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "parameter")) { result.Parameter.Add(DocumentReferenceParser.ParseDocumentReferenceServiceParameterComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse OrderResponse /// </summary> public static Hl7.Fhir.Model.OrderResponse ParseOrderResponse(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.OrderResponse existingInstance = null) { Hl7.Fhir.Model.OrderResponse result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.OrderResponse(); 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 request else if (atName == "request") { result.Request = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element date else if (atName == "date") { result.DateElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element who else if (atName == "who") { result.Who = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element authority else if (atName == "authority") { result.Authority = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element cost else if (atName == "cost") { result.Cost = MoneyParser.ParseMoney(reader, errors); } // Parse element code else if (atName == "code") { result.CodeElement = CodeParser.ParseCode <Hl7.Fhir.Model.OrderResponse.OrderOutcomeCode>(reader, errors); } // Parse element description else if (atName == "description") { result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element fulfillment else if (atName == "fulfillment") { result.Fulfillment = new List <Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "fulfillment")) { result.Fulfillment.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse Study /// </summary> public static Hl7.Fhir.Model.Study ParseStudy(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Study existingInstance = null) { Hl7.Fhir.Model.Study result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Study(); 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 identifier else if (ParserUtils.IsAtFhirElement(reader, "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 sponsor else if (ParserUtils.IsAtFhirElement(reader, "sponsor")) { result.Sponsor = FhirStringParser.ParseFhirString(reader, errors); } // Parse element title else if (ParserUtils.IsAtFhirElement(reader, "title")) { result.Title = FhirStringParser.ParseFhirString(reader, errors); } // Parse element description else if (ParserUtils.IsAtFhirElement(reader, "description")) { result.Description = FhirStringParser.ParseFhirString(reader, errors); } // Parse element type else if (ParserUtils.IsAtFhirElement(reader, "type")) { result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element condition else if (ParserUtils.IsAtFhirElement(reader, "condition")) { result.Condition = new List <Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "condition")) { result.Condition.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); } reader.LeaveArray(); } // Parse element treatment else if (ParserUtils.IsAtFhirElement(reader, "treatment")) { result.Treatment = new List <Hl7.Fhir.Model.Study.StudyTreatmentComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "treatment")) { result.Treatment.Add(StudyParser.ParseStudyTreatmentComponent(reader, errors)); } reader.LeaveArray(); } // Parse element controlType else if (ParserUtils.IsAtFhirElement(reader, "controlType")) { result.ControlType = new List <Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "controlType")) { result.ControlType.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); } reader.LeaveArray(); } // Parse element objective else if (ParserUtils.IsAtFhirElement(reader, "objective")) { result.Objective = new List <Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "objective")) { result.Objective.Add(FhirStringParser.ParseFhirString(reader, errors)); } reader.LeaveArray(); } // Parse element outcomeMeasure else if (ParserUtils.IsAtFhirElement(reader, "outcomeMeasure")) { result.OutcomeMeasure = new List <Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "outcomeMeasure")) { result.OutcomeMeasure.Add(FhirStringParser.ParseFhirString(reader, errors)); } reader.LeaveArray(); } // Parse element eligibility else if (ParserUtils.IsAtFhirElement(reader, "eligibility")) { result.Eligibility = new List <Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "eligibility")) { result.Eligibility.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } // Parse element period else if (ParserUtils.IsAtFhirElement(reader, "period")) { result.Period = PeriodParser.ParsePeriod(reader, errors); } // Parse element duration else if (ParserUtils.IsAtFhirElement(reader, "duration")) { result.Duration = DurationParser.ParseDuration(reader, errors); } // Parse element plannedEnrollment else if (ParserUtils.IsAtFhirElement(reader, "plannedEnrollment")) { result.PlannedEnrollment = IntegerParser.ParseInteger(reader, errors); } // Parse element intervention else if (ParserUtils.IsAtFhirElement(reader, "intervention")) { result.Intervention = StudyParser.ParseStudyInterventionComponent(reader, errors); } // Parse element protocol else if (ParserUtils.IsAtFhirElement(reader, "protocol")) { result.Protocol = new List <Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "protocol")) { result.Protocol.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } // Parse element dataStructure else if (ParserUtils.IsAtFhirElement(reader, "dataStructure")) { result.DataStructure = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element data else if (ParserUtils.IsAtFhirElement(reader, "data")) { result.Data = new List <Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "data")) { result.Data.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <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); }
/// <summary> /// Parse ConceptSetComponent /// </summary> public static Hl7.Fhir.Model.ValueSet.ConceptSetComponent ParseConceptSetComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ValueSet.ConceptSetComponent existingInstance = null) { Hl7.Fhir.Model.ValueSet.ConceptSetComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ValueSet.ConceptSetComponent(); 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 system else if (atName == "system") { result.SystemElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element version else if (atName == "version") { result.VersionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element code else if (atName == "code") { result.CodeElement = new List <Hl7.Fhir.Model.Code>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "code")) { result.CodeElement.Add(CodeParser.ParseCode(reader, errors)); } reader.LeaveArray(); } // Parse element filter else if (atName == "filter") { result.Filter = new List <Hl7.Fhir.Model.ValueSet.ConceptSetFilterComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "filter")) { result.Filter.Add(ValueSetParser.ParseConceptSetFilterComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse GroupComponent /// </summary> public static Hl7.Fhir.Model.Questionnaire.GroupComponent ParseGroupComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Questionnaire.GroupComponent existingInstance = null) { Hl7.Fhir.Model.Questionnaire.GroupComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Questionnaire.GroupComponent(); 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 header else if (atName == "header") { result.HeaderElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element text else if (atName == "text") { result.TextElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element subject else if (atName == "subject") { result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element question else if (atName == "question") { result.Question = new List <Hl7.Fhir.Model.Questionnaire.QuestionComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "question")) { result.Question.Add(QuestionnaireParser.ParseQuestionComponent(reader, errors)); } reader.LeaveArray(); } // Parse element group else if (atName == "group") { result.Group = new List <Hl7.Fhir.Model.Questionnaire.GroupComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "group")) { result.Group.Add(QuestionnaireParser.ParseGroupComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse ValueSetDefineConceptComponent /// </summary> public static Hl7.Fhir.Model.ValueSet.ValueSetDefineConceptComponent ParseValueSetDefineConceptComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ValueSet.ValueSetDefineConceptComponent existingInstance = null) { Hl7.Fhir.Model.ValueSet.ValueSetDefineConceptComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ValueSet.ValueSetDefineConceptComponent(); 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 abstract else if (atName == "abstract") { result.AbstractElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element display else if (atName == "display") { result.DisplayElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element definition else if (atName == "definition") { result.DefinitionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element concept else if (atName == "concept") { result.Concept = new List <Hl7.Fhir.Model.ValueSet.ValueSetDefineConceptComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "concept")) { result.Concept.Add(ValueSetParser.ParseValueSetDefineConceptComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse ElementDefinitionComponent /// </summary> public static Hl7.Fhir.Model.Profile.ElementDefinitionComponent ParseElementDefinitionComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Profile.ElementDefinitionComponent existingInstance = null) { Hl7.Fhir.Model.Profile.ElementDefinitionComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Profile.ElementDefinitionComponent(); 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 short else if (atName == "short") { result.ShortElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element formal else if (atName == "formal") { result.FormalElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element comments else if (atName == "comments") { result.CommentsElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element requirements else if (atName == "requirements") { result.RequirementsElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element synonym else if (atName == "synonym") { result.SynonymElement = new List <Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "synonym")) { result.SynonymElement.Add(FhirStringParser.ParseFhirString(reader, errors)); } reader.LeaveArray(); } // Parse element min else if (atName == "min") { result.MinElement = IntegerParser.ParseInteger(reader, errors); } // Parse element max else if (atName == "max") { result.MaxElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element type else if (atName == "type") { result.Type = new List <Hl7.Fhir.Model.Profile.TypeRefComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "type")) { result.Type.Add(ProfileParser.ParseTypeRefComponent(reader, errors)); } reader.LeaveArray(); } // Parse element nameReference else if (atName == "nameReference") { result.NameReferenceElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element value else if (atName.StartsWith("value")) { result.Value = FhirParser.ParseElement(reader, errors); } // Parse element example else if (atName.StartsWith("example")) { result.Example = FhirParser.ParseElement(reader, errors); } // Parse element maxLength else if (atName == "maxLength") { result.MaxLengthElement = IntegerParser.ParseInteger(reader, errors); } // Parse element condition else if (atName == "condition") { result.ConditionElement = new List <Hl7.Fhir.Model.Id>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "condition")) { result.ConditionElement.Add(IdParser.ParseId(reader, errors)); } reader.LeaveArray(); } // Parse element constraint else if (atName == "constraint") { result.Constraint = new List <Hl7.Fhir.Model.Profile.ElementDefinitionConstraintComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "constraint")) { result.Constraint.Add(ProfileParser.ParseElementDefinitionConstraintComponent(reader, errors)); } reader.LeaveArray(); } // Parse element mustSupport else if (atName == "mustSupport") { result.MustSupportElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element isModifier else if (atName == "isModifier") { result.IsModifierElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element binding else if (atName == "binding") { result.BindingElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element mapping else if (atName == "mapping") { result.Mapping = new List <Hl7.Fhir.Model.Profile.ElementDefinitionMappingComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "mapping")) { result.Mapping.Add(ProfileParser.ParseElementDefinitionMappingComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse PrescriptionAdministrationRequestComponent /// </summary> public static Prescription.PrescriptionAdministrationRequestComponent ParsePrescriptionAdministrationRequestComponent(IFhirReader reader, ErrorList errors, Prescription.PrescriptionAdministrationRequestComponent existingInstance = null) { Prescription.PrescriptionAdministrationRequestComponent result = existingInstance != null ? existingInstance : new Prescription.PrescriptionAdministrationRequestComponent(); 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 description else if (ParserUtils.IsAtFhirElement(reader, "description")) { result.Description = FhirStringParser.ParseFhirString(reader, errors); } // Parse element totalPeriodicDose else if (ParserUtils.IsAtFhirElement(reader, "totalPeriodicDose")) { result.TotalPeriodicDose = RatioParser.ParseRatio(reader, errors); } // Parse element start else if (ParserUtils.IsAtFhirElement(reader, "start")) { result.Start = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element end else if (ParserUtils.IsAtFhirElement(reader, "end")) { result.End = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element duration else if (ParserUtils.IsAtFhirElement(reader, "duration")) { result.Duration = QuantityParser.ParseQuantity(reader, errors); } // Parse element numberOfAdministrations else if (ParserUtils.IsAtFhirElement(reader, "numberOfAdministrations")) { result.NumberOfAdministrations = IntegerParser.ParseInteger(reader, errors); } // Parse element dosageInstruction else if (ParserUtils.IsAtFhirElement(reader, "dosageInstruction")) { result.DosageInstruction = new List <Prescription.PrescriptionAdministrationRequestDosageInstructionComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "dosageInstruction")) { result.DosageInstruction.Add(PrescriptionParser.ParsePrescriptionAdministrationRequestDosageInstructionComponent(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); }
/// <summary> /// Parse ProfileBindingComponent /// </summary> public static Hl7.Fhir.Model.Profile.ProfileBindingComponent ParseProfileBindingComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Profile.ProfileBindingComponent existingInstance = null) { Hl7.Fhir.Model.Profile.ProfileBindingComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Profile.ProfileBindingComponent(); 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 isExtensible else if (atName == "isExtensible") { result.IsExtensibleElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element conformance else if (atName == "conformance") { result.ConformanceElement = CodeParser.ParseCode <Hl7.Fhir.Model.Profile.BindingConformance>(reader, errors); } // Parse element description else if (atName == "description") { result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element reference else if (atName.StartsWith("reference")) { result.Reference = FhirParser.ParseElement(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse Problem /// </summary> public static Hl7.Fhir.Model.Problem ParseProblem(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Problem existingInstance = null) { Hl7.Fhir.Model.Problem result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Problem(); 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 subject else if (ParserUtils.IsAtFhirElement(reader, "subject")) { result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element visit else if (ParserUtils.IsAtFhirElement(reader, "visit")) { result.Visit = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element asserter else if (ParserUtils.IsAtFhirElement(reader, "asserter")) { result.Asserter = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element dateAsserted else if (ParserUtils.IsAtFhirElement(reader, "dateAsserted")) { result.DateAsserted = DateParser.ParseDate(reader, errors); } // Parse element code else if (ParserUtils.IsAtFhirElement(reader, "code")) { result.Code = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element category else if (ParserUtils.IsAtFhirElement(reader, "category")) { result.Category = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element status else if (ParserUtils.IsAtFhirElement(reader, "status")) { result.Status = CodeParser.ParseCode <Hl7.Fhir.Model.Problem.ProblemStatus>(reader, errors); } // Parse element certainty else if (ParserUtils.IsAtFhirElement(reader, "certainty")) { result.Certainty = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element severity else if (ParserUtils.IsAtFhirElement(reader, "severity")) { result.Severity = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element onset else if (ParserUtils.IsAtFhirElement(reader, "onset", true)) { result.Onset = FhirParser.ParseElement(reader, errors); } // Parse element abatement else if (ParserUtils.IsAtFhirElement(reader, "abatement", true)) { result.Abatement = FhirParser.ParseElement(reader, errors); } // Parse element stage else if (ParserUtils.IsAtFhirElement(reader, "stage")) { result.Stage = ProblemParser.ParseProblemStageComponent(reader, errors); } // Parse element evidence else if (ParserUtils.IsAtFhirElement(reader, "evidence")) { result.Evidence = new List <Hl7.Fhir.Model.Problem.ProblemEvidenceComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "evidence")) { result.Evidence.Add(ProblemParser.ParseProblemEvidenceComponent(reader, errors)); } reader.LeaveArray(); } // Parse element location else if (ParserUtils.IsAtFhirElement(reader, "location")) { result.Location = new List <Hl7.Fhir.Model.Problem.ProblemLocationComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "location")) { result.Location.Add(ProblemParser.ParseProblemLocationComponent(reader, errors)); } reader.LeaveArray(); } // Parse element relatedItem else if (ParserUtils.IsAtFhirElement(reader, "relatedItem")) { result.RelatedItem = new List <Hl7.Fhir.Model.Problem.ProblemRelatedItemComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "relatedItem")) { result.RelatedItem.Add(ProblemParser.ParseProblemRelatedItemComponent(reader, errors)); } reader.LeaveArray(); } // Parse element notes else if (ParserUtils.IsAtFhirElement(reader, "notes")) { result.Notes = 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); }
/// <summary> /// Parse ElementComponent /// </summary> public static Hl7.Fhir.Model.Profile.ElementComponent ParseElementComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Profile.ElementComponent existingInstance = null) { Hl7.Fhir.Model.Profile.ElementComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Profile.ElementComponent(); 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 path else if (atName == "path") { result.PathElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element name else if (atName == "name") { result.NameElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element slicing else if (atName == "slicing") { result.Slicing = ProfileParser.ParseElementSlicingComponent(reader, errors); } // Parse element definition else if (atName == "definition") { result.Definition = ProfileParser.ParseElementDefinitionComponent(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse Group /// </summary> public static Hl7.Fhir.Model.Group ParseGroup(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Group existingInstance = null) { Hl7.Fhir.Model.Group result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Group(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (atName == "language") { result.LanguageElement = CodeParser.ParseCode(reader, errors); } // Parse element text else if (atName == "text") { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (atName == "contained") { result.Contained = new List <Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element identifier else if (atName == "identifier") { result.Identifier = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element type else if (atName == "type") { result.TypeElement = CodeParser.ParseCode <Hl7.Fhir.Model.Group.GroupType>(reader, errors); } // Parse element actual else if (atName == "actual") { result.ActualElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element code else if (atName == "code") { result.Code = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element name else if (atName == "name") { result.NameElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element quantity else if (atName == "quantity") { result.QuantityElement = IntegerParser.ParseInteger(reader, errors); } // Parse element characteristic else if (atName == "characteristic") { result.Characteristic = new List <Hl7.Fhir.Model.Group.GroupCharacteristicComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "characteristic")) { result.Characteristic.Add(GroupParser.ParseGroupCharacteristicComponent(reader, errors)); } reader.LeaveArray(); } // Parse element member else if (atName == "member") { result.Member = new List <Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "member")) { result.Member.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse CodeableConcept /// </summary> public static Hl7.Fhir.Model.CodeableConcept ParseCodeableConcept(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.CodeableConcept existingInstance = null) { Hl7.Fhir.Model.CodeableConcept result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.CodeableConcept(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element coding else if (atName == "coding") { result.Coding = new List <Hl7.Fhir.Model.Coding>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "coding")) { result.Coding.Add(CodingParser.ParseCoding(reader, errors)); } reader.LeaveArray(); } // Parse element text else if (atName == "text") { result.TextElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element primary else if (atName == "primary") { result.PrimaryElement = IdRefParser.ParseIdRef(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse Procedure /// </summary> public static Hl7.Fhir.Model.Procedure ParseProcedure(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Procedure existingInstance = null) { Hl7.Fhir.Model.Procedure result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Procedure(); 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 type else if (atName == "type") { result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element bodySite else if (atName == "bodySite") { result.BodySite = new List <Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "bodySite")) { result.BodySite.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); } reader.LeaveArray(); } // Parse element indication else if (atName == "indication") { result.IndicationElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element performer else if (atName == "performer") { result.Performer = new List <Hl7.Fhir.Model.Procedure.ProcedurePerformerComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "performer")) { result.Performer.Add(ProcedureParser.ParseProcedurePerformerComponent(reader, errors)); } reader.LeaveArray(); } // Parse element date else if (atName == "date") { result.Date = PeriodParser.ParsePeriod(reader, errors); } // Parse element encounter else if (atName == "encounter") { result.Encounter = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element outcome else if (atName == "outcome") { result.OutcomeElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element report else if (atName == "report") { result.Report = new List <Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "report")) { result.Report.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } // Parse element complication else if (atName == "complication") { result.ComplicationElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element followUp else if (atName == "followUp") { result.FollowUpElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element relatedItem else if (atName == "relatedItem") { result.RelatedItem = new List <Hl7.Fhir.Model.Procedure.ProcedureRelatedItemComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "relatedItem")) { result.RelatedItem.Add(ProcedureParser.ParseProcedureRelatedItemComponent(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); }
/// <summary> /// Parse SampledData /// </summary> public static Hl7.Fhir.Model.SampledData ParseSampledData(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.SampledData existingInstance = null) { Hl7.Fhir.Model.SampledData result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.SampledData(); 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 origin else if (atName == "origin") { result.Origin = QuantityParser.ParseQuantity(reader, errors); } // Parse element period else if (atName == "period") { result.PeriodElement = FhirDecimalParser.ParseFhirDecimal(reader, errors); } // Parse element factor else if (atName == "factor") { result.FactorElement = FhirDecimalParser.ParseFhirDecimal(reader, errors); } // Parse element lowerLimit else if (atName == "lowerLimit") { result.LowerLimitElement = FhirDecimalParser.ParseFhirDecimal(reader, errors); } // Parse element upperLimit else if (atName == "upperLimit") { result.UpperLimitElement = FhirDecimalParser.ParseFhirDecimal(reader, errors); } // Parse element dimensions else if (atName == "dimensions") { result.DimensionsElement = IntegerParser.ParseInteger(reader, errors); } // Parse element data else if (atName == "data") { result.DataElement = FhirStringParser.ParseFhirString(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse Observation /// </summary> public static Hl7.Fhir.Model.Observation ParseObservation(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Observation existingInstance = null) { Hl7.Fhir.Model.Observation result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Observation(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (atName == "language") { result.LanguageElement = CodeParser.ParseCode(reader, errors); } // Parse element text else if (atName == "text") { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (atName == "contained") { result.Contained = new List <Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element name else if (atName == "name") { result.Name = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element value else if (atName.StartsWith("value")) { result.Value = FhirParser.ParseElement(reader, errors); } // Parse element interpretation else if (atName == "interpretation") { result.Interpretation = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element comments else if (atName == "comments") { result.CommentsElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element applies else if (atName.StartsWith("applies")) { result.Applies = FhirParser.ParseElement(reader, errors); } // Parse element issued else if (atName == "issued") { result.IssuedElement = InstantParser.ParseInstant(reader, errors); } // Parse element status else if (atName == "status") { result.StatusElement = CodeParser.ParseCode <Hl7.Fhir.Model.ObservationStatus>(reader, errors); } // Parse element reliability else if (atName == "reliability") { result.ReliabilityElement = CodeParser.ParseCode <Hl7.Fhir.Model.Observation.ObservationReliability>(reader, errors); } // Parse element bodySite else if (atName == "bodySite") { result.BodySite = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element method else if (atName == "method") { result.Method = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element identifier else if (atName == "identifier") { result.Identifier = IdentifierParser.ParseIdentifier(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 referenceRange else if (atName == "referenceRange") { result.ReferenceRange = new List <Hl7.Fhir.Model.Observation.ObservationReferenceRangeComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "referenceRange")) { result.ReferenceRange.Add(ObservationParser.ParseObservationReferenceRangeComponent(reader, errors)); } reader.LeaveArray(); } // Parse element component else if (atName == "component") { result.Component = new List <Hl7.Fhir.Model.Observation.ObservationComponentComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "component")) { result.Component.Add(ObservationParser.ParseObservationComponentComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse SecurityEventEventComponent /// </summary> public static Hl7.Fhir.Model.SecurityEvent.SecurityEventEventComponent ParseSecurityEventEventComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.SecurityEvent.SecurityEventEventComponent existingInstance = null) { Hl7.Fhir.Model.SecurityEvent.SecurityEventEventComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.SecurityEvent.SecurityEventEventComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element type else if (atName == "type") { result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element subtype else if (atName == "subtype") { result.Subtype = new List <Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "subtype")) { result.Subtype.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); } reader.LeaveArray(); } // Parse element action else if (atName == "action") { result.ActionElement = CodeParser.ParseCode <Hl7.Fhir.Model.SecurityEvent.SecurityEventAction>(reader, errors); } // Parse element dateTime else if (atName == "dateTime") { result.DateTimeElement = InstantParser.ParseInstant(reader, errors); } // Parse element outcome else if (atName == "outcome") { result.OutcomeElement = CodeParser.ParseCode <Hl7.Fhir.Model.SecurityEvent.SecurityEventOutcome>(reader, errors); } // Parse element outcomeDesc else if (atName == "outcomeDesc") { result.OutcomeDescElement = 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); }