/// <summary> /// Parse Identifier /// </summary> public static Hl7.Fhir.Model.Identifier ParseIdentifier(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Identifier existingInstance = null ) { Hl7.Fhir.Model.Identifier result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Identifier(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element use else if( atName == "use" ) result.UseElement = CodeParser.ParseCode<Hl7.Fhir.Model.Identifier.IdentifierUse>(reader, errors); // Parse element label else if( atName == "label" ) result.LabelElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element system else if( atName == "system" ) result.SystemElement = FhirUriParser.ParseFhirUri(reader, errors); // Parse element key else if( atName == "key" ) result.KeyElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element period else if( atName == "period" ) result.Period = PeriodParser.ParsePeriod(reader, errors); // Parse element assigner else if( atName == "assigner" ) result.Assigner = ResourceReferenceParser.ParseResourceReference(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse InterestOfCare /// </summary> public static Hl7.Fhir.Model.InterestOfCare ParseInterestOfCare(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.InterestOfCare existingInstance = null ) { Hl7.Fhir.Model.InterestOfCare result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.InterestOfCare(); 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))); 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 Quantity /// </summary> public static Hl7.Fhir.Model.Quantity ParseQuantity(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Quantity existingInstance = null ) { Hl7.Fhir.Model.Quantity result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Quantity(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element value else if( atName == "value" ) result.ValueElement = FhirDecimalParser.ParseFhirDecimal(reader, errors); // Parse element comparator else if( atName == "comparator" ) result.ComparatorElement = CodeParser.ParseCode<Hl7.Fhir.Model.Quantity.QuantityCompararator>(reader, errors); // Parse element units else if( atName == "units" ) result.UnitsElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element system else if( atName == "system" ) result.SystemElement = FhirUriParser.ParseFhirUri(reader, errors); // Parse element code else if( atName == "code" ) result.CodeElement = CodeParser.ParseCode(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse Choice /// </summary> public static Hl7.Fhir.Model.Choice ParseChoice(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Choice existingInstance = null ) { Hl7.Fhir.Model.Choice result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Choice(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element code else if( atName == "code" ) result.CodeElement = CodeParser.ParseCode(reader, errors); // Parse element option else if( atName == "option" ) { result.Option = new List<Hl7.Fhir.Model.Choice.ChoiceOptionComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "option") ) result.Option.Add(ChoiceParser.ParseChoiceOptionComponent(reader, errors)); reader.LeaveArray(); } // Parse element isOrdered else if( atName == "isOrdered" ) result.IsOrderedElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse Schedule /// </summary> public static Hl7.Fhir.Model.Schedule ParseSchedule(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Schedule existingInstance = null ) { Hl7.Fhir.Model.Schedule result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Schedule(); 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 event else if( atName == "event" ) { result.Event = new List<Hl7.Fhir.Model.Period>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "event") ) result.Event.Add(PeriodParser.ParsePeriod(reader, errors)); reader.LeaveArray(); } // Parse element repeat else if( atName == "repeat" ) result.Repeat = ScheduleParser.ParseScheduleRepeatComponent(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 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 ResourceReference /// </summary> public static Hl7.Fhir.Model.ResourceReference ParseResourceReference(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ResourceReference existingInstance = null ) { Hl7.Fhir.Model.ResourceReference result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ResourceReference(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element type else if( atName == "type" ) result.TypeElement = CodeParser.ParseCode(reader, errors); // Parse element reference else if( atName == "reference" ) result.ReferenceElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element display else if( atName == "display" ) result.DisplayElement = FhirStringParser.ParseFhirString(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse AnimalComponent /// </summary> public static Hl7.Fhir.Model.Patient.AnimalComponent ParseAnimalComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Patient.AnimalComponent existingInstance = null ) { Hl7.Fhir.Model.Patient.AnimalComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Patient.AnimalComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element species else if( atName == "species" ) result.Species = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element breed else if( atName == "breed" ) result.Breed = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element genderStatus else if( atName == "genderStatus" ) result.GenderStatus = CodeableConceptParser.ParseCodeableConcept(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse Range /// </summary> public static Hl7.Fhir.Model.Range ParseRange(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Range existingInstance = null ) { Hl7.Fhir.Model.Range result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Range(); 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 low else if( atName == "low" ) result.Low = QuantityParser.ParseQuantity(reader, errors); // Parse element high else if( atName == "high" ) result.High = QuantityParser.ParseQuantity(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse Narrative /// </summary> public static Hl7.Fhir.Model.Narrative ParseNarrative(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Narrative existingInstance = null ) { Hl7.Fhir.Model.Narrative result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Narrative(); 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 status else if( atName == "status" ) result.StatusElement = CodeParser.ParseCode<Hl7.Fhir.Model.Narrative.NarrativeStatus>(reader, errors); // Parse element div else if( atName == "div" ) result.DivElement = XHtml.Parse(reader.ReadPrimitiveContents(typeof(XHtml))); 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 Visit /// </summary> public static Hl7.Fhir.Model.Visit ParseVisit(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Visit existingInstance = null) { Hl7.Fhir.Model.Visit result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Visit(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (atName == "language") { result.Language = 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.LocalId = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element identifier else if (atName == "identifier") { result.Identifier = new List <Hl7.Fhir.Model.Identifier>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "identifier")) { result.Identifier.Add(IdentifierParser.ParseIdentifier(reader, errors)); } reader.LeaveArray(); } // Parse element status else if (atName == "status") { result.Status = CodeParser.ParseCode <Hl7.Fhir.Model.Visit.EncounterState>(reader, errors); } // Parse element class else if (atName == "class") { result.Class = CodeParser.ParseCode <Hl7.Fhir.Model.Visit.EncounterClass>(reader, errors); } // Parse element type else if (atName == "type") { result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element subject else if (atName == "subject") { result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element participant else if (atName == "participant") { result.Participant = new List <Hl7.Fhir.Model.Visit.VisitParticipantComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "participant")) { result.Participant.Add(VisitParser.ParseVisitParticipantComponent(reader, errors)); } reader.LeaveArray(); } // Parse element fulfills else if (atName == "fulfills") { result.Fulfills = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element length else if (atName == "length") { result.Length = DurationParser.ParseDuration(reader, errors); } // Parse element reason else if (atName.StartsWith("reason")) { result.Reason = FhirParser.ParseElement(reader, errors); } // Parse element indication else if (atName == "indication") { result.Indication = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element priority else if (atName == "priority") { result.Priority = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element hospitalization else if (atName == "hospitalization") { result.Hospitalization = VisitParser.ParseVisitHospitalizationComponent(reader, errors); } // Parse element location else if (atName == "location") { result.Location = new List <Hl7.Fhir.Model.Visit.VisitLocationComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "location")) { result.Location.Add(VisitParser.ParseVisitLocationComponent(reader, errors)); } reader.LeaveArray(); } // Parse element serviceProvider else if (atName == "serviceProvider") { result.ServiceProvider = 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 Encounter /// </summary> public static Hl7.Fhir.Model.Encounter ParseEncounter(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Encounter existingInstance = null ) { Hl7.Fhir.Model.Encounter result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Encounter(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element identifier else if( atName == "identifier" ) { result.Identifier = new List<Hl7.Fhir.Model.Identifier>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "identifier") ) result.Identifier.Add(IdentifierParser.ParseIdentifier(reader, errors)); reader.LeaveArray(); } // Parse element status else if( atName == "status" ) result.StatusElement = CodeParser.ParseCode<Hl7.Fhir.Model.Encounter.EncounterState>(reader, errors); // Parse element class else if( atName == "class" ) result.ClassElement = CodeParser.ParseCode<Hl7.Fhir.Model.Encounter.EncounterClass>(reader, errors); // Parse element type else if( atName == "type" ) { result.Type = new List<Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "type") ) result.Type.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); reader.LeaveArray(); } // Parse element subject else if( atName == "subject" ) result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element participant else if( atName == "participant" ) { result.Participant = new List<Hl7.Fhir.Model.Encounter.EncounterParticipantComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "participant") ) result.Participant.Add(EncounterParser.ParseEncounterParticipantComponent(reader, errors)); reader.LeaveArray(); } // Parse element fulfills else if( atName == "fulfills" ) result.Fulfills = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element start else if( atName == "start" ) result.StartElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); // Parse element length else if( atName == "length" ) result.Length = DurationParser.ParseDuration(reader, errors); // Parse element reason else if( atName.StartsWith("reason") ) result.Reason = FhirParser.ParseElement(reader, errors); // Parse element indication else if( atName == "indication" ) result.Indication = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element priority else if( atName == "priority" ) result.Priority = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element hospitalization else if( atName == "hospitalization" ) result.Hospitalization = EncounterParser.ParseEncounterHospitalizationComponent(reader, errors); // Parse element location else if( atName == "location" ) { result.Location = new List<Hl7.Fhir.Model.Encounter.EncounterLocationComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "location") ) result.Location.Add(EncounterParser.ParseEncounterLocationComponent(reader, errors)); reader.LeaveArray(); } // Parse element serviceProvider else if( atName == "serviceProvider" ) result.ServiceProvider = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element partOf else if( atName == "partOf" ) result.PartOf = ResourceReferenceParser.ParseResourceReference(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse EncounterHospitalizationAccomodationComponent /// </summary> public static Hl7.Fhir.Model.Encounter.EncounterHospitalizationAccomodationComponent ParseEncounterHospitalizationAccomodationComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Encounter.EncounterHospitalizationAccomodationComponent existingInstance = null ) { Hl7.Fhir.Model.Encounter.EncounterHospitalizationAccomodationComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Encounter.EncounterHospitalizationAccomodationComponent(); 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 bed else if( atName == "bed" ) result.Bed = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element period else if( atName == "period" ) result.Period = PeriodParser.ParsePeriod(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse MedicationAdministration /// </summary> public static Hl7.Fhir.Model.MedicationAdministration ParseMedicationAdministration(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.MedicationAdministration existingInstance = null ) { Hl7.Fhir.Model.MedicationAdministration result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.MedicationAdministration(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element identifier else if( atName == "identifier" ) { result.Identifier = new List<Hl7.Fhir.Model.Identifier>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "identifier") ) result.Identifier.Add(IdentifierParser.ParseIdentifier(reader, errors)); reader.LeaveArray(); } // Parse element status else if( atName == "status" ) result.StatusElement = CodeParser.ParseCode<Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatus>(reader, errors); // Parse element patient else if( atName == "patient" ) result.Patient = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element practitioner else if( atName == "practitioner" ) result.Practitioner = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element encounter else if( atName == "encounter" ) result.Encounter = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element prescription else if( atName == "prescription" ) result.Prescription = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element wasNotGiven else if( atName == "wasNotGiven" ) result.WasNotGivenElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element reasonNotGiven else if( atName == "reasonNotGiven" ) { result.ReasonNotGiven = new List<Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "reasonNotGiven") ) result.ReasonNotGiven.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); reader.LeaveArray(); } // Parse element whenGiven else if( atName == "whenGiven" ) result.WhenGiven = PeriodParser.ParsePeriod(reader, errors); // Parse element medication else if( atName == "medication" ) result.Medication = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element administrationDevice else if( atName == "administrationDevice" ) { result.AdministrationDevice = new List<Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "administrationDevice") ) result.AdministrationDevice.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); reader.LeaveArray(); } // Parse element dosage else if( atName == "dosage" ) { result.Dosage = new List<Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationDosageComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "dosage") ) result.Dosage.Add(MedicationAdministrationParser.ParseMedicationAdministrationDosageComponent(reader, errors)); reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse ConformanceRestSecurityComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent ParseConformanceRestSecurityComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent existingInstance = null) { Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element service else if (atName == "service") { result.Service = new List <Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "service")) { result.Service.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); } reader.LeaveArray(); } // Parse element description else if (atName == "description") { result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element certificate else if (atName == "certificate") { result.Certificate = new List <Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "certificate")) { result.Certificate.Add(ConformanceParser.ParseConformanceRestSecurityCertificateComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse ConformanceRestQueryComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestQueryComponent ParseConformanceRestQueryComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestQueryComponent existingInstance = null) { Hl7.Fhir.Model.Conformance.ConformanceRestQueryComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestQueryComponent(); 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 documentation else if (atName == "documentation") { result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element parameter else if (atName == "parameter") { result.Parameter = new List <Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "parameter")) { result.Parameter.Add(ConformanceParser.ParseConformanceRestResourceSearchParamComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse ConformanceRestSecurityCertificateComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent ParseConformanceRestSecurityCertificateComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element type else if( atName == "type" ) result.TypeElement = CodeParser.ParseCode(reader, errors); // Parse element blob else if( atName == "blob" ) result.BlobElement = Base64BinaryParser.ParseBase64Binary(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <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 VisitHospitalizationComponent /// </summary> public static Hl7.Fhir.Model.Visit.VisitHospitalizationComponent ParseVisitHospitalizationComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Visit.VisitHospitalizationComponent existingInstance = null) { Hl7.Fhir.Model.Visit.VisitHospitalizationComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Visit.VisitHospitalizationComponent(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalId = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element preAdmissionIdentifier else if (atName == "preAdmissionIdentifier") { result.PreAdmissionIdentifier = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element preAdmissionTest else if (atName == "preAdmissionTest") { result.PreAdmissionTest = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element origin else if (atName == "origin") { result.Origin = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element admitSource else if (atName == "admitSource") { result.AdmitSource = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element period else if (atName == "period") { result.Period = PeriodParser.ParsePeriod(reader, errors); } // Parse element accomodation else if (atName == "accomodation") { result.Accomodation = new List <Hl7.Fhir.Model.Visit.VisitHospitalizationAccomodationComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "accomodation")) { result.Accomodation.Add(VisitParser.ParseVisitHospitalizationAccomodationComponent(reader, errors)); } reader.LeaveArray(); } // Parse element diet else if (atName == "diet") { result.Diet = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element specialCourtesy else if (atName == "specialCourtesy") { result.SpecialCourtesy = new List <Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "specialCourtesy")) { result.SpecialCourtesy.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); } reader.LeaveArray(); } // Parse element specialArrangement else if (atName == "specialArrangement") { result.SpecialArrangement = new List <Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "specialArrangement")) { result.SpecialArrangement.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); } reader.LeaveArray(); } // Parse element destination else if (atName == "destination") { result.Destination = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element dischargeDisposition else if (atName == "dischargeDisposition") { result.DischargeDisposition = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element reAdmission else if (atName == "reAdmission") { result.ReAdmission = FhirBooleanParser.ParseFhirBoolean(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse ConformanceRestComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestComponent ParseConformanceRestComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceRestComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element mode else if( atName == "mode" ) result.ModeElement = CodeParser.ParseCode<Hl7.Fhir.Model.Conformance.RestfulConformanceMode>(reader, errors); // Parse element documentation else if( atName == "documentation" ) result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element security else if( atName == "security" ) result.Security = ConformanceParser.ParseConformanceRestSecurityComponent(reader, errors); // Parse element resource else if( atName == "resource" ) { result.Resource = new List<Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "resource") ) result.Resource.Add(ConformanceParser.ParseConformanceRestResourceComponent(reader, errors)); reader.LeaveArray(); } // Parse element batch else if( atName == "batch" ) result.BatchElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element history else if( atName == "history" ) result.HistoryElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element query else if( atName == "query" ) { result.Query = new List<Hl7.Fhir.Model.Conformance.ConformanceRestQueryComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "query") ) result.Query.Add(ConformanceParser.ParseConformanceRestQueryComponent(reader, errors)); reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse VisitParticipantComponent /// </summary> public static Hl7.Fhir.Model.Visit.VisitParticipantComponent ParseVisitParticipantComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Visit.VisitParticipantComponent existingInstance = null) { Hl7.Fhir.Model.Visit.VisitParticipantComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Visit.VisitParticipantComponent(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalId = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element type else if (atName == "type") { result.Type = new List <Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "type")) { result.Type.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); } reader.LeaveArray(); } // Parse element practitioner else if (atName == "practitioner") { result.Practitioner = ResourceReferenceParser.ParseResourceReference(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse XdsEntry /// </summary> public static XdsEntry ParseXdsEntry(IFhirReader reader, ErrorList errors, XdsEntry existingInstance = null) { XdsEntry result = existingInstance != null ? existingInstance : new XdsEntry(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if (ParserUtils.IsAtFhirElement(reader, "extension")) { result.Extension = new List <Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (ParserUtils.IsAtFhirElement(reader, "language")) { result.Language = CodeParser.ParseCode(reader, errors); } // Parse element text else if (ParserUtils.IsAtFhirElement(reader, "text")) { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (ParserUtils.IsAtFhirElement(reader, "contained")) { result.Contained = new List <Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element internalId else if (reader.IsAtRefIdElement()) { result.InternalId = Id.Parse(reader.ReadRefIdContents()); } // Parse element url else if (ParserUtils.IsAtFhirElement(reader, "url")) { result.Url = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element repositoryId else if (ParserUtils.IsAtFhirElement(reader, "repositoryId")) { result.RepositoryId = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element mimeType else if (ParserUtils.IsAtFhirElement(reader, "mimeType")) { result.MimeType = FhirStringParser.ParseFhirString(reader, errors); } // Parse element format else if (ParserUtils.IsAtFhirElement(reader, "format")) { result.Format = CodingParser.ParseCoding(reader, errors); } // Parse element class else if (ParserUtils.IsAtFhirElement(reader, "class")) { result.Class = CodingParser.ParseCoding(reader, errors); } // Parse element type else if (ParserUtils.IsAtFhirElement(reader, "type")) { result.Type = CodingParser.ParseCoding(reader, errors); } // Parse element title else if (ParserUtils.IsAtFhirElement(reader, "title")) { result.Title = FhirStringParser.ParseFhirString(reader, errors); } // Parse element documentId else if (ParserUtils.IsAtFhirElement(reader, "documentId")) { result.DocumentId = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element availability else if (ParserUtils.IsAtFhirElement(reader, "availability")) { result.Availability = CodeParser.ParseCode <XdsEntry.XdsEntryAvailability>(reader, errors); } // Parse element confidentialityCode else if (ParserUtils.IsAtFhirElement(reader, "confidentialityCode")) { result.ConfidentialityCode = CodingParser.ParseCoding(reader, errors); } // Parse element created else if (ParserUtils.IsAtFhirElement(reader, "created")) { result.Created = InstantParser.ParseInstant(reader, errors); } // Parse element event else if (ParserUtils.IsAtFhirElement(reader, "event")) { result.Event = new List <Coding>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "event")) { result.Event.Add(CodingParser.ParseCoding(reader, errors)); } reader.LeaveArray(); } // Parse element hash else if (ParserUtils.IsAtFhirElement(reader, "hash")) { result.Hash = FhirStringParser.ParseFhirString(reader, errors); } // Parse element size else if (ParserUtils.IsAtFhirElement(reader, "size")) { result.Size = FhirStringParser.ParseFhirString(reader, errors); } // Parse element lang else if (ParserUtils.IsAtFhirElement(reader, "lang")) { result.Lang = FhirStringParser.ParseFhirString(reader, errors); } // Parse element folder else if (ParserUtils.IsAtFhirElement(reader, "folder")) { result.Folder = new List <ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "folder")) { result.Folder.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } // Parse element patientId else if (ParserUtils.IsAtFhirElement(reader, "patientId")) { result.PatientId = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element sourcePatientId else if (ParserUtils.IsAtFhirElement(reader, "sourcePatientId")) { result.SourcePatientId = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element patientInfo else if (ParserUtils.IsAtFhirElement(reader, "patientInfo")) { result.PatientInfo = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element author else if (ParserUtils.IsAtFhirElement(reader, "author")) { result.Author = new List <XdsEntry.XdsEntryAuthorComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "author")) { result.Author.Add(XdsEntryParser.ParseXdsEntryAuthorComponent(reader, errors)); } reader.LeaveArray(); } // Parse element authenticator else if (ParserUtils.IsAtFhirElement(reader, "authenticator")) { result.Authenticator = XdsEntryParser.ParseXdsEntryAuthenticatorComponent(reader, errors); } // Parse element facilityType else if (ParserUtils.IsAtFhirElement(reader, "facilityType")) { result.FacilityType = CodingParser.ParseCoding(reader, errors); } // Parse element practiceSetting else if (ParserUtils.IsAtFhirElement(reader, "practiceSetting")) { result.PracticeSetting = CodingParser.ParseCoding(reader, errors); } // Parse element homeCommunity else if (ParserUtils.IsAtFhirElement(reader, "homeCommunity")) { result.HomeCommunity = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element service else if (ParserUtils.IsAtFhirElement(reader, "service")) { result.Service = XdsEntryParser.ParseXdsEntryServiceComponent(reader, errors); } // Parse element comments else if (ParserUtils.IsAtFhirElement(reader, "comments")) { result.Comments = FhirStringParser.ParseFhirString(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse XdsEntryAuthorComponent /// </summary> public static XdsEntry.XdsEntryAuthorComponent ParseXdsEntryAuthorComponent(IFhirReader reader, ErrorList errors, XdsEntry.XdsEntryAuthorComponent existingInstance = null) { XdsEntry.XdsEntryAuthorComponent result = existingInstance != null ? existingInstance : new XdsEntry.XdsEntryAuthorComponent(); 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 name else if (ParserUtils.IsAtFhirElement(reader, "name")) { result.Name = HumanNameParser.ParseHumanName(reader, errors); } // Parse element id else if (ParserUtils.IsAtFhirElement(reader, "id")) { result.Id = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element role else if (ParserUtils.IsAtFhirElement(reader, "role")) { result.Role = new List <FhirString>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "role")) { result.Role.Add(FhirStringParser.ParseFhirString(reader, errors)); } reader.LeaveArray(); } // Parse element specialty else if (ParserUtils.IsAtFhirElement(reader, "specialty")) { result.Specialty = new List <FhirString>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "specialty")) { result.Specialty.Add(FhirStringParser.ParseFhirString(reader, errors)); } reader.LeaveArray(); } // Parse element institution else if (ParserUtils.IsAtFhirElement(reader, "institution")) { result.Institution = new List <XdsEntry.XdsEntryAuthorInstitutionComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "institution")) { result.Institution.Add(XdsEntryParser.ParseXdsEntryAuthorInstitutionComponent(reader, errors)); } reader.LeaveArray(); } // Parse element contact else if (ParserUtils.IsAtFhirElement(reader, "contact")) { result.Contact = new List <Contact>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contact")) { result.Contact.Add(ContactParser.ParseContact(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 XdsFolder /// </summary> public static XdsFolder ParseXdsFolder(IFhirReader reader, ErrorList errors, XdsFolder existingInstance = null) { XdsFolder result = existingInstance != null ? existingInstance : new XdsFolder(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if (ParserUtils.IsAtFhirElement(reader, "extension")) { result.Extension = new List <Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (ParserUtils.IsAtFhirElement(reader, "language")) { result.Language = CodeParser.ParseCode(reader, errors); } // Parse element text else if (ParserUtils.IsAtFhirElement(reader, "text")) { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (ParserUtils.IsAtFhirElement(reader, "contained")) { result.Contained = new List <Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element internalId else if (reader.IsAtRefIdElement()) { result.InternalId = Id.Parse(reader.ReadRefIdContents()); } // Parse element code else if (ParserUtils.IsAtFhirElement(reader, "code")) { result.Code = new List <Coding>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "code")) { result.Code.Add(CodingParser.ParseCoding(reader, errors)); } reader.LeaveArray(); } // Parse element title else if (ParserUtils.IsAtFhirElement(reader, "title")) { result.Title = FhirStringParser.ParseFhirString(reader, errors); } // Parse element patientId else if (ParserUtils.IsAtFhirElement(reader, "patientId")) { result.PatientId = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element homeCommunity else if (ParserUtils.IsAtFhirElement(reader, "homeCommunity")) { result.HomeCommunity = FhirStringParser.ParseFhirString(reader, errors); } // Parse element comments else if (ParserUtils.IsAtFhirElement(reader, "comments")) { result.Comments = FhirStringParser.ParseFhirString(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse Product /// </summary> public static Product ParseProduct(IFhirReader reader, ErrorList errors, Product existingInstance = null) { Product result = existingInstance != null ? existingInstance : new Product(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if (ParserUtils.IsAtFhirElement(reader, "extension")) { result.Extension = new List <Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (ParserUtils.IsAtFhirElement(reader, "language")) { result.Language = CodeParser.ParseCode(reader, errors); } // Parse element text else if (ParserUtils.IsAtFhirElement(reader, "text")) { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (ParserUtils.IsAtFhirElement(reader, "contained")) { result.Contained = new List <Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element internalId else if (reader.IsAtRefIdElement()) { result.InternalId = Id.Parse(reader.ReadRefIdContents()); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse ConformanceRestResourceComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent ParseConformanceRestResourceComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element type else if( atName == "type" ) result.TypeElement = CodeParser.ParseCode(reader, errors); // Parse element profile else if( atName == "profile" ) result.Profile = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element operation else if( atName == "operation" ) { result.Operation = new List<Hl7.Fhir.Model.Conformance.ConformanceRestResourceOperationComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "operation") ) result.Operation.Add(ConformanceParser.ParseConformanceRestResourceOperationComponent(reader, errors)); reader.LeaveArray(); } // Parse element readHistory else if( atName == "readHistory" ) result.ReadHistoryElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element searchInclude else if( atName == "searchInclude" ) { result.SearchIncludeElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "searchInclude") ) result.SearchIncludeElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } // Parse element searchParam else if( atName == "searchParam" ) { result.SearchParam = new List<Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "searchParam") ) result.SearchParam.Add(ConformanceParser.ParseConformanceRestResourceSearchParamComponent(reader, errors)); reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse ImmunizationVaccinationProtocolComponent /// </summary> public static Hl7.Fhir.Model.Immunization.ImmunizationVaccinationProtocolComponent ParseImmunizationVaccinationProtocolComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Immunization.ImmunizationVaccinationProtocolComponent existingInstance = null) { Hl7.Fhir.Model.Immunization.ImmunizationVaccinationProtocolComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Immunization.ImmunizationVaccinationProtocolComponent(); 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 doseSequence else if (atName == "doseSequence") { result.DoseSequenceElement = IntegerParser.ParseInteger(reader, errors); } // Parse element description else if (atName == "description") { result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element authority else if (atName == "authority") { result.Authority = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element series else if (atName == "series") { result.SeriesElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element seriesDoses else if (atName == "seriesDoses") { result.SeriesDosesElement = IntegerParser.ParseInteger(reader, errors); } // Parse element doseTarget else if (atName == "doseTarget") { result.DoseTarget = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element doseStatus else if (atName == "doseStatus") { result.DoseStatus = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element doseStatusReason else if (atName == "doseStatusReason") { result.DoseStatusReason = 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 ConformanceSoftwareComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent ParseConformanceSoftwareComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceSoftwareComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element name else if( atName == "name" ) result.NameElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element version else if( atName == "version" ) result.VersionElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element releaseDate else if( atName == "releaseDate" ) result.ReleaseDateElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse Immunization /// </summary> public static Hl7.Fhir.Model.Immunization ParseImmunization(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Immunization existingInstance = null) { Hl7.Fhir.Model.Immunization result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Immunization(); 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 date else if (atName == "date") { result.DateElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element vaccineType else if (atName == "vaccineType") { result.VaccineType = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element subject else if (atName == "subject") { result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element refusedIndicator else if (atName == "refusedIndicator") { result.RefusedIndicatorElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element reported else if (atName == "reported") { result.ReportedElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element performer else if (atName == "performer") { result.Performer = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element requester else if (atName == "requester") { result.Requester = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element manufacturer else if (atName == "manufacturer") { result.Manufacturer = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element location else if (atName == "location") { result.Location = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element lotNumber else if (atName == "lotNumber") { result.LotNumberElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element expirationDate else if (atName == "expirationDate") { result.ExpirationDateElement = DateParser.ParseDate(reader, errors); } // Parse element site else if (atName == "site") { result.Site = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element route else if (atName == "route") { result.Route = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element doseQuantity else if (atName == "doseQuantity") { result.DoseQuantity = QuantityParser.ParseQuantity(reader, errors); } // Parse element explanation else if (atName == "explanation") { result.Explanation = ImmunizationParser.ParseImmunizationExplanationComponent(reader, errors); } // Parse element reaction else if (atName == "reaction") { result.Reaction = new List <Hl7.Fhir.Model.Immunization.ImmunizationReactionComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "reaction")) { result.Reaction.Add(ImmunizationParser.ParseImmunizationReactionComponent(reader, errors)); } reader.LeaveArray(); } // Parse element vaccinationProtocol else if (atName == "vaccinationProtocol") { result.VaccinationProtocol = ImmunizationParser.ParseImmunizationVaccinationProtocolComponent(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 ImagingStudy /// </summary> public static Hl7.Fhir.Model.ImagingStudy ParseImagingStudy(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ImagingStudy existingInstance = null) { Hl7.Fhir.Model.ImagingStudy result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ImagingStudy(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (atName == "language") { result.LanguageElement = CodeParser.ParseCode(reader, errors); } // Parse element text else if (atName == "text") { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (atName == "contained") { result.Contained = new List <Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element dateTime else if (atName == "dateTime") { result.DateTimeElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element subject else if (atName == "subject") { result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element uid else if (atName == "uid") { result.UidElement = OidParser.ParseOid(reader, errors); } // Parse element accessionNo else if (atName == "accessionNo") { result.AccessionNo = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element identifier else if (atName == "identifier") { result.Identifier = new List <Hl7.Fhir.Model.Identifier>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "identifier")) { result.Identifier.Add(IdentifierParser.ParseIdentifier(reader, errors)); } reader.LeaveArray(); } // Parse element modality else if (atName == "modality") { result.Modality_Element = new List <Code <Hl7.Fhir.Model.ImagingStudy.ImagingModality> >(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "modality")) { result.Modality_Element.Add(CodeParser.ParseCode <Hl7.Fhir.Model.ImagingStudy.ImagingModality>(reader, errors)); } reader.LeaveArray(); } // Parse element referrer else if (atName == "referrer") { result.Referrer = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element availability else if (atName == "availability") { result.AvailabilityElement = CodeParser.ParseCode <Hl7.Fhir.Model.ImagingStudy.InstanceAvailability>(reader, errors); } // Parse element url else if (atName == "url") { result.UrlElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element numberOfSeries else if (atName == "numberOfSeries") { result.NumberOfSeriesElement = IntegerParser.ParseInteger(reader, errors); } // Parse element numberOfInstances else if (atName == "numberOfInstances") { result.NumberOfInstancesElement = IntegerParser.ParseInteger(reader, errors); } // Parse element clinicalInformation else if (atName == "clinicalInformation") { result.ClinicalInformationElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element procedure else if (atName == "procedure") { result.Procedure = new List <Hl7.Fhir.Model.Coding>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "procedure")) { result.Procedure.Add(CodingParser.ParseCoding(reader, errors)); } reader.LeaveArray(); } // Parse element interpreter else if (atName == "interpreter") { result.Interpreter = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element description else if (atName == "description") { result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element series else if (atName == "series") { result.Series = new List <Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "series")) { result.Series.Add(ImagingStudyParser.ParseImagingStudySeriesComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse ConformanceMessagingComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent ParseConformanceMessagingComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent existingInstance = null) { Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element endpoint else if (atName == "endpoint") { result.EndpointElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element reliableCache else if (atName == "reliableCache") { result.ReliableCacheElement = IntegerParser.ParseInteger(reader, errors); } // Parse element documentation else if (atName == "documentation") { result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element event else if (atName == "event") { result.Event = new List <Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "event")) { result.Event.Add(ConformanceParser.ParseConformanceMessagingEventComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse ConformanceRestComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestComponent ParseConformanceRestComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestComponent existingInstance = null) { Hl7.Fhir.Model.Conformance.ConformanceRestComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element mode else if (atName == "mode") { result.ModeElement = CodeParser.ParseCode <Hl7.Fhir.Model.Conformance.RestfulConformanceMode>(reader, errors); } // Parse element documentation else if (atName == "documentation") { result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element security else if (atName == "security") { result.Security = ConformanceParser.ParseConformanceRestSecurityComponent(reader, errors); } // Parse element resource else if (atName == "resource") { result.Resource = new List <Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "resource")) { result.Resource.Add(ConformanceParser.ParseConformanceRestResourceComponent(reader, errors)); } reader.LeaveArray(); } // Parse element batch else if (atName == "batch") { result.BatchElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element history else if (atName == "history") { result.HistoryElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element query else if (atName == "query") { result.Query = new List <Hl7.Fhir.Model.Conformance.ConformanceRestQueryComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "query")) { result.Query.Add(ConformanceParser.ParseConformanceRestQueryComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse ConformanceRestResourceComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent ParseConformanceRestResourceComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent existingInstance = null) { Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestResourceComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element type else if (atName == "type") { result.TypeElement = CodeParser.ParseCode(reader, errors); } // Parse element profile else if (atName == "profile") { result.Profile = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element operation else if (atName == "operation") { result.Operation = new List <Hl7.Fhir.Model.Conformance.ConformanceRestResourceOperationComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "operation")) { result.Operation.Add(ConformanceParser.ParseConformanceRestResourceOperationComponent(reader, errors)); } reader.LeaveArray(); } // Parse element readHistory else if (atName == "readHistory") { result.ReadHistoryElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element searchInclude else if (atName == "searchInclude") { result.SearchIncludeElement = new List <Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "searchInclude")) { result.SearchIncludeElement.Add(FhirStringParser.ParseFhirString(reader, errors)); } reader.LeaveArray(); } // Parse element searchParam else if (atName == "searchParam") { result.SearchParam = new List <Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "searchParam")) { result.SearchParam.Add(ConformanceParser.ParseConformanceRestResourceSearchParamComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse Conformance /// </summary> public static Hl7.Fhir.Model.Conformance ParseConformance(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance existingInstance = null) { Hl7.Fhir.Model.Conformance result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (atName == "language") { result.LanguageElement = CodeParser.ParseCode(reader, errors); } // Parse element text else if (atName == "text") { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (atName == "contained") { result.Contained = new List <Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element identifier else if (atName == "identifier") { result.IdentifierElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element version else if (atName == "version") { result.VersionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element name else if (atName == "name") { result.NameElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element publisher else if (atName == "publisher") { result.PublisherElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element telecom else if (atName == "telecom") { result.Telecom = new List <Hl7.Fhir.Model.Contact>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "telecom")) { result.Telecom.Add(ContactParser.ParseContact(reader, errors)); } reader.LeaveArray(); } // Parse element description else if (atName == "description") { result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element status else if (atName == "status") { result.StatusElement = CodeParser.ParseCode <Hl7.Fhir.Model.Conformance.ConformanceStatementStatus>(reader, errors); } // Parse element experimental else if (atName == "experimental") { result.ExperimentalElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element date else if (atName == "date") { result.DateElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element software else if (atName == "software") { result.Software = ConformanceParser.ParseConformanceSoftwareComponent(reader, errors); } // Parse element implementation else if (atName == "implementation") { result.Implementation = ConformanceParser.ParseConformanceImplementationComponent(reader, errors); } // Parse element fhirVersion else if (atName == "fhirVersion") { result.FhirVersionElement = IdParser.ParseId(reader, errors); } // Parse element acceptUnknown else if (atName == "acceptUnknown") { result.AcceptUnknownElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element format else if (atName == "format") { result.FormatElement = new List <Hl7.Fhir.Model.Code>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "format")) { result.FormatElement.Add(CodeParser.ParseCode(reader, errors)); } reader.LeaveArray(); } // Parse element rest else if (atName == "rest") { result.Rest = new List <Hl7.Fhir.Model.Conformance.ConformanceRestComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "rest")) { result.Rest.Add(ConformanceParser.ParseConformanceRestComponent(reader, errors)); } reader.LeaveArray(); } // Parse element messaging else if (atName == "messaging") { result.Messaging = new List <Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "messaging")) { result.Messaging.Add(ConformanceParser.ParseConformanceMessagingComponent(reader, errors)); } reader.LeaveArray(); } // Parse element document else if (atName == "document") { result.Document = new List <Hl7.Fhir.Model.Conformance.ConformanceDocumentComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "document")) { result.Document.Add(ConformanceParser.ParseConformanceDocumentComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse FamilyHistoryRelationComponent /// </summary> public static Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationComponent ParseFamilyHistoryRelationComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationComponent existingInstance = null) { Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationComponent(); 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 relationship else if (atName == "relationship") { result.Relationship = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element deceased else if (atName.StartsWith("deceased")) { result.Deceased = FhirParser.ParseElement(reader, errors); } // Parse element note else if (atName == "note") { result.NoteElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element condition else if (atName == "condition") { result.Condition = new List <Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationConditionComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "condition")) { result.Condition.Add(FamilyHistoryParser.ParseFamilyHistoryRelationConditionComponent(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 ConformanceMessagingEventComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent ParseConformanceMessagingEventComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent existingInstance = null) { Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element code else if (atName == "code") { result.CodeElement = CodeParser.ParseCode(reader, errors); } // Parse element mode else if (atName == "mode") { result.ModeElement = CodeParser.ParseCode <Hl7.Fhir.Model.Conformance.ConformanceEventMode>(reader, errors); } // Parse element protocol else if (atName == "protocol") { result.Protocol = new List <Hl7.Fhir.Model.Coding>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "protocol")) { result.Protocol.Add(CodingParser.ParseCoding(reader, errors)); } reader.LeaveArray(); } // Parse element focus else if (atName == "focus") { result.FocusElement = CodeParser.ParseCode(reader, errors); } // Parse element request else if (atName == "request") { result.Request = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element response else if (atName == "response") { result.Response = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element documentation else if (atName == "documentation") { result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse FamilyHistory /// </summary> public static Hl7.Fhir.Model.FamilyHistory ParseFamilyHistory(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.FamilyHistory existingInstance = null) { Hl7.Fhir.Model.FamilyHistory result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.FamilyHistory(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (atName == "language") { result.LanguageElement = CodeParser.ParseCode(reader, errors); } // Parse element text else if (atName == "text") { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (atName == "contained") { result.Contained = new List <Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element subject else if (atName == "subject") { result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element note else if (atName == "note") { result.NoteElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element relation else if (atName == "relation") { result.Relation = new List <Hl7.Fhir.Model.FamilyHistory.FamilyHistoryRelationComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "relation")) { result.Relation.Add(FamilyHistoryParser.ParseFamilyHistoryRelationComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse ProtocolStepPreconditionComponent /// </summary> public static Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionComponent ParseProtocolStepPreconditionComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionComponent existingInstance = null) { Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionComponent(); 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 description else if (ParserUtils.IsAtFhirElement(reader, "description")) { result.Description = FhirStringParser.ParseFhirString(reader, errors); } // Parse element condition else if (ParserUtils.IsAtFhirElement(reader, "condition")) { result.Condition = ProtocolParser.ParseProtocolStepPreconditionConditionComponent(reader, errors); } // Parse element intersection else if (ParserUtils.IsAtFhirElement(reader, "intersection")) { result.Intersection = new List <Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "intersection")) { result.Intersection.Add(ProtocolParser.ParseProtocolStepPreconditionComponent(reader, errors)); } reader.LeaveArray(); } // Parse element union else if (ParserUtils.IsAtFhirElement(reader, "union")) { result.Union = new List <Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "union")) { result.Union.Add(ProtocolParser.ParseProtocolStepPreconditionComponent(reader, errors)); } reader.LeaveArray(); } // Parse element exclude else if (ParserUtils.IsAtFhirElement(reader, "exclude")) { result.Exclude = new List <Hl7.Fhir.Model.Protocol.ProtocolStepPreconditionComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "exclude")) { result.Exclude.Add(ProtocolParser.ParseProtocolStepPreconditionComponent(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 XdsEntry2 /// </summary> public static XdsEntry2 ParseXdsEntry2(IFhirReader reader, ErrorList errors, XdsEntry2 existingInstance = null) { XdsEntry2 result = existingInstance != null ? existingInstance : new XdsEntry2(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if (ParserUtils.IsAtFhirElement(reader, "extension")) { result.Extension = new List <Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (ParserUtils.IsAtFhirElement(reader, "language")) { result.Language = CodeParser.ParseCode(reader, errors); } // Parse element text else if (ParserUtils.IsAtFhirElement(reader, "text")) { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (ParserUtils.IsAtFhirElement(reader, "contained")) { result.Contained = new List <Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element internalId else if (reader.IsAtRefIdElement()) { result.InternalId = Id.Parse(reader.ReadRefIdContents()); } // Parse element id else if (ParserUtils.IsAtFhirElement(reader, "id")) { result.Id = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element information else if (ParserUtils.IsAtFhirElement(reader, "information")) { result.Information = DocumentInformationParser.ParseDocumentInformation(reader, errors); } // Parse element format else if (ParserUtils.IsAtFhirElement(reader, "format")) { result.Format = CodingParser.ParseCoding(reader, errors); } // Parse element availability else if (ParserUtils.IsAtFhirElement(reader, "availability")) { result.Availability = CodeParser.ParseCode(reader, errors); } // Parse element folder else if (ParserUtils.IsAtFhirElement(reader, "folder")) { result.Folder = new List <ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "folder")) { result.Folder.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } // Parse element subject else if (ParserUtils.IsAtFhirElement(reader, "subject")) { result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element content else if (ParserUtils.IsAtFhirElement(reader, "content")) { result.Content = AttachmentParser.ParseAttachment(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse HumanName /// </summary> public static Hl7.Fhir.Model.HumanName ParseHumanName(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.HumanName existingInstance = null ) { Hl7.Fhir.Model.HumanName result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.HumanName(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element use else if( atName == "use" ) result.UseElement = CodeParser.ParseCode<Hl7.Fhir.Model.HumanName.NameUse>(reader, errors); // Parse element text else if( atName == "text" ) result.TextElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element family else if( atName == "family" ) { result.FamilyElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "family") ) result.FamilyElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } // Parse element given else if( atName == "given" ) { result.GivenElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "given") ) result.GivenElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } // Parse element prefix else if( atName == "prefix" ) { result.PrefixElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "prefix") ) result.PrefixElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } // Parse element suffix else if( atName == "suffix" ) { result.SuffixElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "suffix") ) result.SuffixElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } // Parse element period else if( atName == "period" ) result.Period = PeriodParser.ParsePeriod(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse GroupCharacteristicComponent /// </summary> public static Hl7.Fhir.Model.Group.GroupCharacteristicComponent ParseGroupCharacteristicComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Group.GroupCharacteristicComponent existingInstance = null ) { Hl7.Fhir.Model.Group.GroupCharacteristicComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Group.GroupCharacteristicComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element type else if( atName == "type" ) result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element value else if( atName.StartsWith("value") ) result.Value = FhirParser.ParseElement(reader, errors); // Parse element exclude else if( atName == "exclude" ) result.ExcludeElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse EncounterHospitalizationComponent /// </summary> public static Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent ParseEncounterHospitalizationComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent existingInstance = null ) { Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Encounter.EncounterHospitalizationComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element preAdmissionIdentifier else if( atName == "preAdmissionIdentifier" ) result.PreAdmissionIdentifier = IdentifierParser.ParseIdentifier(reader, errors); // Parse element origin else if( atName == "origin" ) result.Origin = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element admitSource else if( atName == "admitSource" ) result.AdmitSource = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element period else if( atName == "period" ) result.Period = PeriodParser.ParsePeriod(reader, errors); // Parse element accomodation else if( atName == "accomodation" ) { result.Accomodation = new List<Hl7.Fhir.Model.Encounter.EncounterHospitalizationAccomodationComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "accomodation") ) result.Accomodation.Add(EncounterParser.ParseEncounterHospitalizationAccomodationComponent(reader, errors)); reader.LeaveArray(); } // Parse element diet else if( atName == "diet" ) result.Diet = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element specialCourtesy else if( atName == "specialCourtesy" ) { result.SpecialCourtesy = new List<Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "specialCourtesy") ) result.SpecialCourtesy.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); reader.LeaveArray(); } // Parse element specialArrangement else if( atName == "specialArrangement" ) { result.SpecialArrangement = new List<Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "specialArrangement") ) result.SpecialArrangement.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); reader.LeaveArray(); } // Parse element destination else if( atName == "destination" ) result.Destination = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element dischargeDisposition else if( atName == "dischargeDisposition" ) result.DischargeDisposition = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element reAdmission else if( atName == "reAdmission" ) result.ReAdmissionElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse 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 ConditionStageComponent /// </summary> public static Hl7.Fhir.Model.Condition.ConditionStageComponent ParseConditionStageComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Condition.ConditionStageComponent existingInstance = null) { Hl7.Fhir.Model.Condition.ConditionStageComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Condition.ConditionStageComponent(); 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 summary else if (atName == "summary") { result.Summary = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element assessment else if (atName == "assessment") { result.Assessment = new List <Hl7.Fhir.Model.ResourceReference>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "assessment")) { result.Assessment.Add(ResourceReferenceParser.ParseResourceReference(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse ConformanceMessagingComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent ParseConformanceMessagingComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element endpoint else if( atName == "endpoint" ) result.EndpointElement = FhirUriParser.ParseFhirUri(reader, errors); // Parse element reliableCache else if( atName == "reliableCache" ) result.ReliableCacheElement = IntegerParser.ParseInteger(reader, errors); // Parse element documentation else if( atName == "documentation" ) result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element event else if( atName == "event" ) { result.Event = new List<Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "event") ) result.Event.Add(ConformanceParser.ParseConformanceMessagingEventComponent(reader, errors)); reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse 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 Condition /// </summary> public static Hl7.Fhir.Model.Condition ParseCondition(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Condition existingInstance = null) { Hl7.Fhir.Model.Condition result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Condition(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (atName == "language") { result.LanguageElement = CodeParser.ParseCode(reader, errors); } // Parse element text else if (atName == "text") { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (atName == "contained") { result.Contained = new List <Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element subject else if (atName == "subject") { result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element encounter else if (atName == "encounter") { result.Encounter = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element asserter else if (atName == "asserter") { result.Asserter = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element dateAsserted else if (atName == "dateAsserted") { result.DateAssertedElement = DateParser.ParseDate(reader, errors); } // Parse element code else if (atName == "code") { result.Code = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element category else if (atName == "category") { result.Category = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element status else if (atName == "status") { result.StatusElement = CodeParser.ParseCode <Hl7.Fhir.Model.Condition.ConditionStatus>(reader, errors); } // Parse element certainty else if (atName == "certainty") { result.Certainty = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element severity else if (atName == "severity") { result.Severity = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element onset else if (atName.StartsWith("onset")) { result.Onset = FhirParser.ParseElement(reader, errors); } // Parse element abatement else if (atName.StartsWith("abatement")) { result.Abatement = FhirParser.ParseElement(reader, errors); } // Parse element stage else if (atName == "stage") { result.Stage = ConditionParser.ParseConditionStageComponent(reader, errors); } // Parse element evidence else if (atName == "evidence") { result.Evidence = new List <Hl7.Fhir.Model.Condition.ConditionEvidenceComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "evidence")) { result.Evidence.Add(ConditionParser.ParseConditionEvidenceComponent(reader, errors)); } reader.LeaveArray(); } // Parse element location else if (atName == "location") { result.Location = new List <Hl7.Fhir.Model.Condition.ConditionLocationComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "location")) { result.Location.Add(ConditionParser.ParseConditionLocationComponent(reader, errors)); } reader.LeaveArray(); } // Parse element relatedItem else if (atName == "relatedItem") { result.RelatedItem = new List <Hl7.Fhir.Model.Condition.ConditionRelatedItemComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "relatedItem")) { result.RelatedItem.Add(ConditionParser.ParseConditionRelatedItemComponent(reader, errors)); } reader.LeaveArray(); } // Parse element notes else if (atName == "notes") { result.NotesElement = FhirStringParser.ParseFhirString(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse AnatomicalLocation /// </summary> public static AnatomicalLocation ParseAnatomicalLocation(IFhirReader reader, ErrorList errors, AnatomicalLocation existingInstance = null ) { AnatomicalLocation result = existingInstance != null ? existingInstance : new AnatomicalLocation(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { // Parse element extension if( ParserUtils.IsAtFhirElement(reader, "extension") ) { result.Extension = new List<Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element language else if( ParserUtils.IsAtFhirElement(reader, "language") ) result.Language = CodeParser.ParseCode(reader, errors); // Parse element text else if( ParserUtils.IsAtFhirElement(reader, "text") ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( ParserUtils.IsAtFhirElement(reader, "contained") ) { result.Contained = new List<Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element internalId else if( reader.IsAtRefIdElement() ) result.InternalId = Id.Parse(reader.ReadRefIdContents()); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return result; }
/// <summary> /// Parse DemographicsLanguageComponent /// </summary> public static Hl7.Fhir.Model.Demographics.DemographicsLanguageComponent ParseDemographicsLanguageComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Demographics.DemographicsLanguageComponent existingInstance = null) { Hl7.Fhir.Model.Demographics.DemographicsLanguageComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Demographics.DemographicsLanguageComponent(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalId = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element language else if (atName == "language") { result.Language = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element mode else if (atName == "mode") { result.Mode = new List <Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "mode")) { result.Mode.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); } reader.LeaveArray(); } // Parse element proficiencyLevel else if (atName == "proficiencyLevel") { result.ProficiencyLevel = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element preference else if (atName == "preference") { result.Preference = FhirBooleanParser.ParseFhirBoolean(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); } catch (Exception ex) { errors.Add(ex.Message, reader); } return(result); }
/// <summary> /// Parse ConformanceMessagingEventComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent ParseConformanceMessagingEventComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceMessagingEventComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element code else if( atName == "code" ) result.CodeElement = CodeParser.ParseCode(reader, errors); // Parse element mode else if( atName == "mode" ) result.ModeElement = CodeParser.ParseCode<Hl7.Fhir.Model.Conformance.ConformanceEventMode>(reader, errors); // Parse element protocol else if( atName == "protocol" ) { result.Protocol = new List<Hl7.Fhir.Model.Coding>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "protocol") ) result.Protocol.Add(CodingParser.ParseCoding(reader, errors)); reader.LeaveArray(); } // Parse element focus else if( atName == "focus" ) result.FocusElement = CodeParser.ParseCode(reader, errors); // Parse element request else if( atName == "request" ) result.Request = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element response else if( atName == "response" ) result.Response = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element documentation else if( atName == "documentation" ) result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors); else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse Demographics /// </summary> public static Hl7.Fhir.Model.Demographics ParseDemographics(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Demographics existingInstance = null) { Hl7.Fhir.Model.Demographics result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Demographics(); try { string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalId = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element identifier else if (atName == "identifier") { result.Identifier = new List <Hl7.Fhir.Model.Identifier>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "identifier")) { result.Identifier.Add(IdentifierParser.ParseIdentifier(reader, errors)); } reader.LeaveArray(); } // Parse element name else if (atName == "name") { result.Name = new List <Hl7.Fhir.Model.HumanName>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "name")) { result.Name.Add(HumanNameParser.ParseHumanName(reader, errors)); } reader.LeaveArray(); } // Parse element telecom else if (atName == "telecom") { result.Telecom = new List <Hl7.Fhir.Model.Contact>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "telecom")) { result.Telecom.Add(ContactParser.ParseContact(reader, errors)); } reader.LeaveArray(); } // Parse element gender else if (atName == "gender") { result.Gender = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element birthDate else if (atName == "birthDate") { result.BirthDate = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element deceased else if (atName == "deceased") { result.Deceased = FhirBooleanParser.ParseFhirBoolean(reader, errors); } // Parse element address else if (atName == "address") { result.Address = new List <Hl7.Fhir.Model.Address>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "address")) { result.Address.Add(AddressParser.ParseAddress(reader, errors)); } reader.LeaveArray(); } // Parse element photo else if (atName == "photo") { result.Photo = new List <Hl7.Fhir.Model.Attachment>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "photo")) { result.Photo.Add(AttachmentParser.ParseAttachment(reader, errors)); } reader.LeaveArray(); } // Parse element maritalStatus else if (atName == "maritalStatus") { result.MaritalStatus = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element language else if (atName == "language") { result.Language = new List <Hl7.Fhir.Model.Demographics.DemographicsLanguageComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "language")) { result.Language.Add(DemographicsParser.ParseDemographicsLanguageComponent(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 Conformance /// </summary> public static Hl7.Fhir.Model.Conformance ParseConformance(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance existingInstance = null ) { Hl7.Fhir.Model.Conformance result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element identifier else if( atName == "identifier" ) result.IdentifierElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element version else if( atName == "version" ) result.VersionElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element name else if( atName == "name" ) result.NameElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element publisher else if( atName == "publisher" ) result.PublisherElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element telecom else if( atName == "telecom" ) { result.Telecom = new List<Hl7.Fhir.Model.Contact>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "telecom") ) result.Telecom.Add(ContactParser.ParseContact(reader, errors)); reader.LeaveArray(); } // Parse element description else if( atName == "description" ) result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element status else if( atName == "status" ) result.StatusElement = CodeParser.ParseCode<Hl7.Fhir.Model.Conformance.ConformanceStatementStatus>(reader, errors); // Parse element experimental else if( atName == "experimental" ) result.ExperimentalElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element date else if( atName == "date" ) result.DateElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); // Parse element software else if( atName == "software" ) result.Software = ConformanceParser.ParseConformanceSoftwareComponent(reader, errors); // Parse element implementation else if( atName == "implementation" ) result.Implementation = ConformanceParser.ParseConformanceImplementationComponent(reader, errors); // Parse element fhirVersion else if( atName == "fhirVersion" ) result.FhirVersionElement = IdParser.ParseId(reader, errors); // Parse element acceptUnknown else if( atName == "acceptUnknown" ) result.AcceptUnknownElement = FhirBooleanParser.ParseFhirBoolean(reader, errors); // Parse element format else if( atName == "format" ) { result.FormatElement = new List<Hl7.Fhir.Model.Code>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "format") ) result.FormatElement.Add(CodeParser.ParseCode(reader, errors)); reader.LeaveArray(); } // Parse element rest else if( atName == "rest" ) { result.Rest = new List<Hl7.Fhir.Model.Conformance.ConformanceRestComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "rest") ) result.Rest.Add(ConformanceParser.ParseConformanceRestComponent(reader, errors)); reader.LeaveArray(); } // Parse element messaging else if( atName == "messaging" ) { result.Messaging = new List<Hl7.Fhir.Model.Conformance.ConformanceMessagingComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "messaging") ) result.Messaging.Add(ConformanceParser.ParseConformanceMessagingComponent(reader, errors)); reader.LeaveArray(); } // Parse element document else if( atName == "document" ) { result.Document = new List<Hl7.Fhir.Model.Conformance.ConformanceDocumentComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "document") ) result.Document.Add(ConformanceParser.ParseConformanceDocumentComponent(reader, errors)); reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse MessageSourceComponent /// </summary> public static Hl7.Fhir.Model.Message.MessageSourceComponent ParseMessageSourceComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Message.MessageSourceComponent existingInstance = null) { Hl7.Fhir.Model.Message.MessageSourceComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Message.MessageSourceComponent(); 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 software else if (atName == "software") { result.SoftwareElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element version else if (atName == "version") { result.VersionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element contact else if (atName == "contact") { result.Contact = ContactParser.ParseContact(reader, errors); } // Parse element endpoint else if (atName == "endpoint") { result.EndpointElement = FhirUriParser.ParseFhirUri(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse ConformanceRestResourceSearchParamComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent ParseConformanceRestResourceSearchParamComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestResourceSearchParamComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element name else if( atName == "name" ) result.NameElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element source else if( atName == "source" ) result.SourceElement = FhirUriParser.ParseFhirUri(reader, errors); // Parse element type else if( atName == "type" ) result.TypeElement = CodeParser.ParseCode<Hl7.Fhir.Model.Conformance.SearchParamType>(reader, errors); // Parse element documentation else if( atName == "documentation" ) result.DocumentationElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element xpath else if( atName == "xpath" ) result.XpathElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element target else if( atName == "target" ) { result.TargetElement = new List<Hl7.Fhir.Model.Code>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "target") ) result.TargetElement.Add(CodeParser.ParseCode(reader, errors)); reader.LeaveArray(); } // Parse element chain else if( atName == "chain" ) { result.ChainElement = new List<Hl7.Fhir.Model.FhirString>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "chain") ) result.ChainElement.Add(FhirStringParser.ParseFhirString(reader, errors)); reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse Message /// </summary> public static Hl7.Fhir.Model.Message ParseMessage(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Message existingInstance = null) { Hl7.Fhir.Model.Message result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Message(); 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 = IdParser.ParseId(reader, errors); } // Parse element timestamp else if (atName == "timestamp") { result.TimestampElement = InstantParser.ParseInstant(reader, errors); } // Parse element event else if (atName == "event") { result.EventElement = CodeParser.ParseCode(reader, errors); } // Parse element response else if (atName == "response") { result.Response = MessageParser.ParseMessageResponseComponent(reader, errors); } // Parse element source else if (atName == "source") { result.Source = MessageParser.ParseMessageSourceComponent(reader, errors); } // Parse element destination else if (atName == "destination") { result.Destination = MessageParser.ParseMessageDestinationComponent(reader, errors); } // Parse element enterer else if (atName == "enterer") { result.Enterer = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element author else if (atName == "author") { result.Author = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element receiver else if (atName == "receiver") { result.Receiver = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element responsible else if (atName == "responsible") { result.Responsible = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element effective else if (atName == "effective") { result.Effective = PeriodParser.ParsePeriod(reader, errors); } // Parse element reason else if (atName == "reason") { result.Reason = CodeableConceptParser.ParseCodeableConcept(reader, errors); } // Parse element data else if (atName == "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(); return(result); }
/// <summary> /// Parse ConformanceRestSecurityComponent /// </summary> public static Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent ParseConformanceRestSecurityComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent existingInstance = null ) { Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Conformance.ConformanceRestSecurityComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element service else if( atName == "service" ) { result.Service = new List<Hl7.Fhir.Model.CodeableConcept>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "service") ) result.Service.Add(CodeableConceptParser.ParseCodeableConcept(reader, errors)); reader.LeaveArray(); } // Parse element description else if( atName == "description" ) result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); // Parse element certificate else if( atName == "certificate" ) { result.Certificate = new List<Hl7.Fhir.Model.Conformance.ConformanceRestSecurityCertificateComponent>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "certificate") ) result.Certificate.Add(ConformanceParser.ParseConformanceRestSecurityCertificateComponent(reader, errors)); reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse ImagingStudySeriesComponent /// </summary> public static Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent ParseImagingStudySeriesComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent existingInstance = null) { Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element number else if (atName == "number") { result.NumberElement = IntegerParser.ParseInteger(reader, errors); } // Parse element modality else if (atName == "modality") { result.ModalityElement = CodeParser.ParseCode <Hl7.Fhir.Model.ImagingStudy.Modality>(reader, errors); } // Parse element uid else if (atName == "uid") { result.UidElement = OidParser.ParseOid(reader, errors); } // Parse element description else if (atName == "description") { result.DescriptionElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element numberOfInstances else if (atName == "numberOfInstances") { result.NumberOfInstancesElement = IntegerParser.ParseInteger(reader, errors); } // Parse element availability else if (atName == "availability") { result.AvailabilityElement = CodeParser.ParseCode <Hl7.Fhir.Model.ImagingStudy.InstanceAvailability>(reader, errors); } // Parse element url else if (atName == "url") { result.UrlElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element bodySite else if (atName == "bodySite") { result.BodySite = CodingParser.ParseCoding(reader, errors); } // Parse element dateTime else if (atName == "dateTime") { result.DateTimeElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors); } // Parse element instance else if (atName == "instance") { result.Instance = new List <Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "instance")) { result.Instance.Add(ImagingStudyParser.ParseImagingStudySeriesInstanceComponent(reader, errors)); } reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
/// <summary> /// Parse RelatedPerson /// </summary> public static Hl7.Fhir.Model.RelatedPerson ParseRelatedPerson(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.RelatedPerson existingInstance = null ) { Hl7.Fhir.Model.RelatedPerson result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.RelatedPerson(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if( atName == "extension" ) { result.Extension = new List<Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "extension") ) result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); reader.LeaveArray(); } // Parse element language else if( atName == "language" ) result.LanguageElement = CodeParser.ParseCode(reader, errors); // Parse element text else if( atName == "text" ) result.Text = NarrativeParser.ParseNarrative(reader, errors); // Parse element contained else if( atName == "contained" ) { result.Contained = new List<Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "contained") ) result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors)); reader.LeaveArray(); } // Parse element _id else if( atName == "_id" ) result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); // Parse element identifier else if( atName == "identifier" ) { result.Identifier = new List<Hl7.Fhir.Model.Identifier>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "identifier") ) result.Identifier.Add(IdentifierParser.ParseIdentifier(reader, errors)); reader.LeaveArray(); } // Parse element patient else if( atName == "patient" ) result.Patient = ResourceReferenceParser.ParseResourceReference(reader, errors); // Parse element relationship else if( atName == "relationship" ) result.Relationship = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element name else if( atName == "name" ) result.Name = HumanNameParser.ParseHumanName(reader, errors); // Parse element telecom else if( atName == "telecom" ) { result.Telecom = new List<Hl7.Fhir.Model.Contact>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "telecom") ) result.Telecom.Add(ContactParser.ParseContact(reader, errors)); reader.LeaveArray(); } // Parse element gender else if( atName == "gender" ) result.Gender = CodeableConceptParser.ParseCodeableConcept(reader, errors); // Parse element address else if( atName == "address" ) result.Address = AddressParser.ParseAddress(reader, errors); // Parse element photo else if( atName == "photo" ) { result.Photo = new List<Hl7.Fhir.Model.Attachment>(); reader.EnterArray(); while( ParserUtils.IsAtArrayElement(reader, "photo") ) result.Photo.Add(AttachmentParser.ParseAttachment(reader, errors)); reader.LeaveArray(); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return result; }
/// <summary> /// Parse ImagingStudySeriesInstanceComponent /// </summary> public static Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent ParseImagingStudySeriesInstanceComponent(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent existingInstance = null) { Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.ImagingStudy.ImagingStudySeriesInstanceComponent(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element number else if (atName == "number") { result.NumberElement = IntegerParser.ParseInteger(reader, errors); } // Parse element uid else if (atName == "uid") { result.UidElement = OidParser.ParseOid(reader, errors); } // Parse element sopclass else if (atName == "sopclass") { result.SopclassElement = OidParser.ParseOid(reader, errors); } // Parse element type else if (atName == "type") { result.TypeElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element title else if (atName == "title") { result.TitleElement = FhirStringParser.ParseFhirString(reader, errors); } // Parse element url else if (atName == "url") { result.UrlElement = FhirUriParser.ParseFhirUri(reader, errors); } // Parse element attachment else if (atName == "attachment") { result.Attachment = ResourceReferenceParser.ParseResourceReference(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }