/// <summary> /// Populates this <see cref="FamilyHistoryPerson"/> instance from the /// data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the family history person data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// If the first node in <paramref name="typeSpecificXml"/> is not /// a family history person node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator itemNav = typeSpecificXml.CreateNavigator().SelectSingleNode("family-history-person"); Validator.ThrowInvalidIfNull(itemNav, Resources.FamilyHistoryPersonUnexpectedNode); // relative-name _relativeName = new PersonItem(); _relativeName.ParseXml(itemNav.SelectSingleNode("relative-name")); // relationship _relationship = XPathHelper.GetOptNavValue <CodableValue>(itemNav, "relationship"); // date-of-birth _dateOfBirth = XPathHelper.GetOptNavValue <ApproximateDate>(itemNav, "date-of-birth"); // date-of-death _dateOfDeath = XPathHelper.GetOptNavValue <ApproximateDate>(itemNav, "date-of-death"); }
/// <summary> /// Populates this Prescription instance from the data in the XML. /// </summary> /// /// <param name="navigator"> /// The XML containing the prescription information. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node indicated by <paramref name="navigator"/> is not a prescription node. /// </exception> /// public override void ParseXml(XPathNavigator navigator) { Validator.ThrowIfNavigatorNull(navigator); // <prescribed-by> _prescribedBy = new PersonItem(); _prescribedBy.ParseXml(navigator.SelectSingleNode("prescribed-by")); // <date-prescribed> _datePrescribed = XPathHelper.GetOptNavValue <ApproximateDateTime>(navigator, "date-prescribed"); // <amount-prescribed> _amountPrescribed = XPathHelper.GetOptNavValue <GeneralMeasurement>(navigator, "amount-prescribed"); // <substitution> _substitution = XPathHelper.GetOptNavValue <CodableValue>(navigator, "substitution"); // <refills> _refills = XPathHelper.GetOptNavValueAsInt(navigator, "refills"); // <days-supply> _daysSupply = XPathHelper.GetOptNavValueAsInt(navigator, "days-supply"); // <prescription-expiration> _expiration = XPathHelper.GetOptNavValue <HealthServiceDate>(navigator, "prescription-expiration"); // <instructions> _instructions = XPathHelper.GetOptNavValue <CodableValue>(navigator, "instructions"); }
/// <summary> /// Populates this appointment instance from the data in the XML. /// </summary> /// /// <param name="typeSpecificXml"> /// The XML to get the appointment data from. /// </param> /// /// <exception cref="InvalidOperationException"> /// The first node in <paramref name="typeSpecificXml"/> is not /// an appointment node. /// </exception> /// protected override void ParseXml(IXPathNavigable typeSpecificXml) { XPathNavigator appointmentNav = typeSpecificXml.CreateNavigator().SelectSingleNode("appointment"); Validator.ThrowInvalidIfNull(appointmentNav, Resources.AppointmentUnexpectedNode); // <when> _when = new HealthServiceDateTime(); _when.ParseXml(appointmentNav.SelectSingleNode("when")); // <duration> _duration = XPathHelper.GetOptNavValue <DurationValue>( appointmentNav, "duration"); // <service> XPathNavigator serviceNav = appointmentNav.SelectSingleNode("service"); if (serviceNav != null) { _service = new CodableValue(); _service.ParseXml(serviceNav); } // <clinic> XPathNavigator clinicNav = appointmentNav.SelectSingleNode("clinic"); if (clinicNav != null) { _clinic = new PersonItem(); _clinic.ParseXml(clinicNav); } // <specialty> XPathNavigator specialtyNav = appointmentNav.SelectSingleNode("specialty"); if (specialtyNav != null) { _specialty = new CodableValue(); _specialty.ParseXml(specialtyNav); } // <status> XPathNavigator statusNav = appointmentNav.SelectSingleNode("status"); if (statusNav != null) { _status = new CodableValue(); _status.ParseXml(statusNav); } // <care-class> XPathNavigator careClassNav = appointmentNav.SelectSingleNode("care-class"); if (careClassNav != null) { _careClass = new CodableValue(); _careClass.ParseXml(careClassNav); } }