/// <summary>
        /// Populates this <see cref="CarePlanTask"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML to get the CarePlanTask data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        /// 
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _name = new CodableValue();
            _name.ParseXml(navigator.SelectSingleNode("name"));
            _description = XPathHelper.GetOptNavValue(navigator, "description");
            _startDate = XPathHelper.GetOptNavValue<ApproximateDateTime>(navigator, "start-date");
            _endDate = XPathHelper.GetOptNavValue<ApproximateDateTime>(navigator, "end-date");
            _sequenceNumber = XPathHelper.GetOptNavValueAsInt(navigator, "sequence-number");
            _contact = XPathHelper.GetOptNavValue<PersonItem>(navigator, "contact");
            _recurrence = XPathHelper.GetOptNavValue<CarePlanTaskRecurrence>(navigator, "recurrence");
            _thingTypeVersionId = XPathHelper.GetOptNavValueAsGuid(navigator, "thing-type-version-id");
            _thingTypeXPath = XPathHelper.GetOptNavValue(navigator, "thing-type-xpath");
            _referenceId = XPathHelper.GetOptNavValue(navigator, "reference-id");
        }
        /// <summary>
        /// Creates a new instance of the <see cref="ExplanationOfBenefits"/> class specifying mandatory values.
        /// </summary>
        ///
        /// <remarks>
        /// This item is not added to the health record until the
        /// <see cref="Microsoft.Health.HealthRecordAccessor.NewItem(HealthRecordItem)"/> method
        /// is called.
        /// </remarks>
        ///
        /// <param name="dateSubmitted">
        /// The date when the claim was submitted.
        /// </param>
        /// <param name="patient">
        /// The name of the patient.
        /// </param>
        /// <param name="plan">
        /// The plan covering this claim.
        /// </param>
        /// <param name="memberId">
        /// The member id of the plan member.
        /// </param>
        /// <param name="claimType">
        /// The type of the claim (medical, dental, etc.)
        /// </param>
        /// <param name="claimId">
        /// The claim id.
        /// </param>
        /// <param name="submittedBy">
        /// The organization that submitted this claim.
        /// </param>
        /// <param name="provider">
        /// The provider that performed the services.
        /// </param>
        /// <param name="currency">
        /// The currency used.
        /// </param>
        /// <param name="claimTotals">
        /// A summary of the financial information about this claim.
        /// </param>
        /// <param name="services">
        /// The service included in this claim.
        /// </param>
        ///
        /// <exception cref="ArgumentException">
        /// If <paramref name="memberId"/> is empty or contains only whitespace.
        /// If <paramref name="claimId"/> is empty or contains only whitespace.
        /// If <paramref name="services"/> is <b>null</b> or doesn't contain any values.            
        /// </exception>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="memberId"/> is <b>null</b>.
        /// If <paramref name="claimId"/> is <b>null</b>.
        /// If <paramref name="dateSubmitted"/> is <b>null</b>.            
        /// If <paramref name="patient"/> is <b>null</b>.            
        /// If <paramref name="plan"/> is <b>null</b>.            
        /// If <paramref name="claimType"/> is <b>null</b>.            
        /// If <paramref name="submittedBy"/> is <b>null</b>.            
        /// If <paramref name="provider"/> is <b>null</b>.            
        /// If <paramref name="currency"/> is <b>null</b>.            
        /// If <paramref name="claimTotals"/> is <b>null</b>.            
        /// </exception>
        ///
        public ExplanationOfBenefits(
            HealthServiceDateTime dateSubmitted,
            PersonItem patient,    
            Organization plan,    
            string memberId,    
            CodableValue claimType,    
            string claimId,    
            Organization submittedBy,    
            Organization provider,    
            CodableValue currency,    
            ClaimAmounts claimTotals,    
            IEnumerable<Service> services)
            : base(TypeId)
        {
            DateSubmitted = dateSubmitted;
            Patient = patient;
            Plan = plan;
            MemberId = memberId;
            ClaimType = claimType;
            ClaimId = claimId;
            SubmittedBy = submittedBy;
            Provider = provider;
            Currency = currency;
            ClaimTotals = claimTotals;

            Validator.ThrowIfArgumentNull(services, "services", "ServicesMandatory");

            foreach (Service val in services)
            {
                Services.Add(val);
            }

            if (Services.Count == 0)
            {
                throw Validator.ArgumentException("services", "ServicesMandatory");
            }
        }
 /// <summary>
 /// Initialize a new instance of the <see cref="FamilyHistoryPerson"/> 
 /// class with mandatory parameters.
 /// </summary>
 /// 
 /// <param name="name">The name of a relative. </param>
 /// 
 /// <exception cref="ArgumentNullException">
 /// If <paramref name="name"/> is <b> null </b>.
 /// </exception>
 /// 
 public FamilyHistoryPerson(PersonItem name)
     : base(TypeId)
 {
     RelativeName = name;
 }
        /// <summary>
        /// Populates the data from the specified XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the medical image study data from.
        /// </param>
        /// 
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="typeSpecificXml"/> parameter is <b>null</b>.
        /// </exception>
        /// 
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a medical image study node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            Validator.ThrowIfArgumentNull(typeSpecificXml, "typeSpecificXml", "ParseXmlNavNull");

            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("medical-image-study");

            Validator.ThrowInvalidIfNull(itemNav, "MedicalImageStudyUnexpectedNode");

            if (_when == null)
            {
                _when = new HealthServiceDateTime();
            }

            _when.ParseXml(itemNav.SelectSingleNode("when"));
            _patientName = XPathHelper.GetOptNavValue(itemNav, "patient-name");
            _description = XPathHelper.GetOptNavValue(itemNav, "description");

            _series.Clear();
            foreach (XPathNavigator imageStudySeriesNav in itemNav.Select("series"))
            {
                MedicalImageStudySeriesV2 imageStudySeries = new MedicalImageStudySeriesV2();
                imageStudySeries.ParseXml(imageStudySeriesNav);
                _series.Add(imageStudySeries);
            }

            _reason = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "reason");
            _previewBlobName = XPathHelper.GetOptNavValue(itemNav, "preview-blob-name");

            _keyImages.Clear();
            foreach (XPathNavigator imageNav in itemNav.Select("key-images"))
            {
                MedicalImageStudySeriesImage image = new MedicalImageStudySeriesImage();
                image.ParseXml(imageNav);
                _keyImages.Add(image);
            }

            _studyInstanceUID = XPathHelper.GetOptNavValue(itemNav, "study-instance-uid");
            _referringPhysician = XPathHelper.GetOptNavValue<PersonItem>(itemNav, "referring-physician");
            _accessionNumber = XPathHelper.GetOptNavValue(itemNav, "accession-number");
        }
        /// <summary>
        /// Populates this <see cref="Allergy"/> instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the allergy data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// an allergy node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            _name.Clear();
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("allergy");

            Validator.ThrowInvalidIfNull(itemNav, "AllergyUnexpectedNode");

            // <name>
            _name.ParseXml(itemNav.SelectSingleNode("name"));

            // <reaction>
            _reaction =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "reaction");

            // <first-observed>
            _firstObserved =
                XPathHelper.GetOptNavValue<ApproximateDateTime>(
                    itemNav,
                    "first-observed");

            // <allergen-type>
            _allergen =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "allergen-type");

            // <allergen-code>
            _allergenCode =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "allergen-code");

            // <treatment-provider>
            _treatmentProvider =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "treatment-provider");

            // <treatment>
            _treatment =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "treatment");

            // <is-negated>
            _isNegated =
                XPathHelper.GetOptNavValueAsBool(itemNav, "is-negated");
        }
        /// <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, "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);
            }
        }
        /// <summary>
        /// Populates this <see cref="FamilyHistoryRelative"/> instance from the data in the XML. 
        /// </summary>
        /// 
        /// <param name="navigator">
        /// The XML to get the relative's data from.
        /// </param>
        /// 
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> is <b> null </b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            _relativeName =
                XPathHelper.GetOptNavValue<PersonItem>(navigator, "relative-name");

            _relationship =
                XPathHelper.GetOptNavValue<CodableValue>(navigator, "relationship");

            _dateOfBirth =
                XPathHelper.GetOptNavValue<ApproximateDate>(navigator, "date-of-birth");

            _dateOfDeath =
                XPathHelper.GetOptNavValue<ApproximateDate>(navigator, "date-of-death");
        }
        /// <summary>
        /// Populates this medical device instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the medical device data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a medical device node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("device");

            Validator.ThrowInvalidIfNull(itemNav, "DeviceUnexpectedNode");

            // <when>
            _when = new HealthServiceDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            // <device-name>
            _deviceName = XPathHelper.GetOptNavValue(itemNav, "device-name");

            // <vendor>
            _vendor = XPathHelper.GetOptNavValue<PersonItem>(itemNav, "vendor");

            // <model>
            _model = XPathHelper.GetOptNavValue(itemNav, "model");

            // <serial-number>
            _serialNumber =
                XPathHelper.GetOptNavValue(itemNav, "serial-number");

            // <anatomic-site>
            _anatomicSite =
                XPathHelper.GetOptNavValue(itemNav, "anatomic-site");

            // <description>
            _description =
                XPathHelper.GetOptNavValue(itemNav, "description");
        }
 /// <summary>
 /// Creates a new instance of the <see cref="Prescription"/> class 
 /// with the specified prescriber.
 /// </summary>
 /// 
 /// <param name="prescribedBy">
 /// The person that prescribed the medication.
 /// </param>
 /// 
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="person"/> parameter is <b>null</b>.
 /// </exception>
 /// 
 public Prescription(PersonItem prescribedBy)
 {
     this.PrescribedBy = prescribedBy;
 }
        /// <summary>
        /// Populates this contraindication instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the contraindication data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a contraindication node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("contraindication");

            Validator.ThrowInvalidIfNull(itemNav, "ContraindicationUnexpectedNode");

            // <substance>
            _substance = new CodableValue();
            _substance.ParseXml(itemNav.SelectSingleNode("substance"));

            // <status>
            _status = new CodableValue();
            _status.ParseXml(itemNav.SelectSingleNode("status"));

            // <source>
            _source = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "source");

            // <documenter>
            _documenter = XPathHelper.GetOptNavValue<PersonItem>(itemNav, "documenter");

            // <documented-date>
            _documentedDate = XPathHelper.GetOptNavValue<ApproximateDateTime>(itemNav, "documented-date");
        }
        /// <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 in <paramref name="typeSpecificXml"/> 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 <see cref="Annotation"/> instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the annotation data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// an annotation node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("annotation");

            Validator.ThrowInvalidIfNull(itemNav, "AnnotationUnexpectedNode");

            _when = new HealthServiceDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            _content =
                XPathHelper.GetOptNavValue(itemNav, "content");

            _author =
                XPathHelper.GetOptNavValue<PersonItem>(itemNav, "author");

            _classification =
                XPathHelper.GetOptNavValue(itemNav, "classification");

            _index =
                XPathHelper.GetOptNavValue(itemNav, "index");

            _version =
                XPathHelper.GetOptNavValue(itemNav, "version");
        }
        /// <summary>
        /// Populates this procedure instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the procedure data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a procedure node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("procedure");

            Validator.ThrowInvalidIfNull(itemNav, "ProcedureUnexpectedNode");

            _when = XPathHelper.GetOptNavValue<ApproximateDateTime>(itemNav, "when");

            _name =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "name");

            _primaryProvider =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "primary-provider");

            _anatomicLocation =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "anatomic-location");

            _secondaryProvider =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "secondary-provider");
        }
        /// <summary>
        /// Populates this <see cref="ExplanationOfBenefits"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the ExplanationOfBenefits data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="typeSpecificXml"/> parameter is <b>null</b>.
        /// </exception>
        /// 
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a ExplanationOfBenefits node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            Validator.ThrowIfArgumentNull(typeSpecificXml, "typeSpecificXml", "ParseXmlNavNull");

            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("explanation-of-benefits");

            Validator.ThrowInvalidIfNull(itemNav, "ExplanationOfBenefitsUnexpectedNode");

            _dateSubmitted = XPathHelper.GetOptNavValue<HealthServiceDateTime>(itemNav, "date-submitted");
            _patient = XPathHelper.GetOptNavValue<PersonItem>(itemNav, "patient");
            _relationshipToMember = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "relationship-to-member");
            _plan = XPathHelper.GetOptNavValue<Organization>(itemNav, "plan");
            _groupId = XPathHelper.GetOptNavValue(itemNav, "group-id");
            _memberId = itemNav.SelectSingleNode("member-id").Value;
            _claimType = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "claim-type");
            _claimId = itemNav.SelectSingleNode("claim-id").Value;
            _submittedBy = XPathHelper.GetOptNavValue<Organization>(itemNav, "submitted-by");
            _provider = XPathHelper.GetOptNavValue<Organization>(itemNav, "provider");
            _currency = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "currency");
            _claimTotals = XPathHelper.GetOptNavValue<ClaimAmounts>(itemNav, "claim-totals");

            _services.Clear();
            foreach(XPathNavigator servicesNav in itemNav.Select("services"))
            {
                Service service = new Service();
                service.ParseXml(servicesNav);
                _services.Add(service);
            }
        }
        /// <summary>
        /// Populates this healthcare proxy instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the healthcare proxy data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node in <paramref name="typeSpecificXml"/> is not
        /// a healthcare proxy node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("healthcare-proxy");

            Validator.ThrowInvalidIfNull(itemNav, "HealthcareProxyUnexpectedNode");

            _when = new HealthServiceDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            // <proxy>
            _proxy =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "proxy");

            // <alternate>
            _alternate =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "alternate");

            // <primary-witness>
            _primaryWitness =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "primary-witness");

            // <secondary-witness>
            _secondaryWitness =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "secondary-witness");

            // <content>
            _content =
                XPathHelper.GetOptNavValue(itemNav, "content");
        }
        /// <summary>
        /// Populates this discharge summary instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the discharge summary data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node of the <paramref name="typeSpecificXml"/> parameter is not
        /// a discharge summary node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("discharge-summary");

            Validator.ThrowInvalidIfNull(itemNav, "DischargeSummaryUnexpectedNode");

            // <when>
            _when = new HealthServiceDateTime();
            _when.ParseXml(itemNav.SelectSingleNode("when"));

            // <type>
            _type =
                XPathHelper.GetOptNavValue<CodableValue>(itemNav, "type");

            // <category>
            _category =
                XPathHelper.GetOptNavValue<CodableValue>(itemNav, "category");

            // <setting>
            _setting =
                XPathHelper.GetOptNavValue<CodableValue>(itemNav, "setting");

            // <specialty>
            _specialty =
                XPathHelper.GetOptNavValue(itemNav, "specialty");

            // <text>
            _text =
                XPathHelper.GetOptNavValue(itemNav, "text");

            // <primary-provider>
            _primaryProvider =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "primary-provider");

            // <primary-provider-endorsement>
            _primaryProviderEndorsement =
                XPathHelper.GetOptNavValue<HealthServiceDateTime>(
                    itemNav,
                    "primary-provider-endorsement");

            // <secondary-provider>
            _secondaryProvider =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "secondary-provider");

            // <secondary-provider-endorsement>
            _secondaryProviderEndorsement =
                XPathHelper.GetOptNavValue<HealthServiceDateTime>(
                    itemNav,
                    "secondary-provider-endorsement");

            // <discharge-date-time>
            _dischargeDateTime =
                XPathHelper.GetOptNavValue<ApproximateDateTime>(
                    itemNav,
                    "discharge-date-time");

            // <admitting-diagnosis>
            _admittingDiagnosis =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "admitting-diagnosis");

            // <principal-diagnosis>
            _principalDiagnosis =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "principal-diagnosis");

            // <additional-diagnosis>
            _additionalDiagnosis =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "additional-diagnosis");

            // <principal-procedure-physician>
            _principalProcedurePhysician =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "principal-procedure-physician");

            // <principal-procedure>
            _principalProcedure =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "principal-procedure");

            // <additional-procedure>
            _additionalProcedure =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "additional-procedure");
        }
        /// <summary>
        /// Populates this <see cref="FamilyHistoryRelativeV3"/> instance from the data in the XML. 
        /// </summary>
        /// 
        /// <param name="navigator">
        /// The XML to get the relative's data from.
        /// </param>
        /// 
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> is <b> null </b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            // relationship
            _relationship = new CodableValue();
            _relationship.ParseXml(navigator.SelectSingleNode("relationship"));

            // relative-name
            _relativeName =
                XPathHelper.GetOptNavValue<PersonItem>(navigator, "relative-name");

            // date-of-birth
            _dateOfBirth =
                XPathHelper.GetOptNavValue<ApproximateDate>(navigator, "date-of-birth");

            // date-of-death
            _dateOfDeath =
                XPathHelper.GetOptNavValue<ApproximateDate>(navigator, "date-of-death");

            //region-of-origin
            _regionOfOrigin =
                XPathHelper.GetOptNavValue<CodableValue>(navigator, "region-of-origin");
        }
        /// <summary>
        /// Populates this <see cref="Directive"/> instance from the data in the XML.
        /// </summary>
        /// 
        /// <param name="typeSpecificXml">
        /// The XML to get the directive data from.
        /// </param>
        /// 
        /// <exception cref="InvalidOperationException">
        /// The first node of the <paramref name="typeSpecificXml"/> 
        /// parameter is not a directive node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("directive");

            Validator.ThrowInvalidIfNull(itemNav, "DirectiveUnexpectedNode");

            // <start-date>
            _startDate = new ApproximateDateTime();
            _startDate.ParseXml(itemNav.SelectSingleNode("start-date"));

            // <stop-date>
            _stopDate = new ApproximateDateTime();
            _stopDate.ParseXml(itemNav.SelectSingleNode("stop-date"));

            // <description>
            _description =
                XPathHelper.GetOptNavValue(itemNav, "description");

            // <full-resuscitation>
            _fullResuscitation =
                XPathHelper.GetOptNavValueAsBool(itemNav, "full-resuscitation");

            // <prohibited-interventions>
            _prohibitedInterventions =
                XPathHelper.GetOptNavValue<CodableValue>(
                    itemNav,
                    "prohibited-interventions");

            // <additional-instructions>
            _additionalInstructions =
                XPathHelper.GetOptNavValue(itemNav, "additional-instructions");

            // <attending-physician>
            _attendingPhysician =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "attending-physician");

            // <attending-physician-endorsement>
            _attendingPhysicianEndorsement =
                XPathHelper.GetOptNavValue<HealthServiceDateTime>(
                    itemNav,
                    "attending-physician-endorsement");

            // <attending-nurse>
            _attendingNurse =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "attending-nurse");

            // <attending-nurse-endorsement" type="d:date-time">
            _attendingNurseEndorsement =
                XPathHelper.GetOptNavValue<HealthServiceDateTime>(
                    itemNav,
                    "attending-nurse-endorsement");

            // <expiration-date>
            _expirationDate =
                XPathHelper.GetOptNavValue<HealthServiceDateTime>(
                    itemNav,
                    "expiration-date");

            // <discontinuation-date>
            _discontinuationDate =
                XPathHelper.GetOptNavValue<ApproximateDateTime>(
                    itemNav,
                    "discontinuation-date");

            // <discontinuation-physician>
            _discontinuationPhysician =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "discontinuation-physician");

            // <discontinuation-physician-endorsement>
            _discontinuationPhysicianEndorsement =
                XPathHelper.GetOptNavValue<HealthServiceDateTime>(
                    itemNav,
                    "discontinuation-physician-endorsement");

            // <discontinuation-nurse>
            _discontinuationNurse =
                XPathHelper.GetOptNavValue<PersonItem>(
                    itemNav,
                    "discontinuation-nurse");

            // <discontinuation-nurse-endorsement>
            _discontinuationNurseEndorsement =
                XPathHelper.GetOptNavValue<HealthServiceDateTime>(
                    itemNav,
                    "discontinuation-nurse-endorsement");
        }
        /// <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, "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 <see cref="CarePlan"/> instance from the data in the specified XML.
        /// </summary>
        ///
        /// <param name="typeSpecificXml">
        /// The XML to get the CarePlan data from.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="typeSpecificXml"/> parameter is <b>null</b>.
        /// </exception>
        /// 
        /// <exception cref="InvalidOperationException">
        /// If the first node in <paramref name="typeSpecificXml"/> is not
        /// a CarePlan node.
        /// </exception>
        /// 
        protected override void ParseXml(IXPathNavigable typeSpecificXml)
        {
            Validator.ThrowIfArgumentNull(typeSpecificXml, "typeSpecificXml", "ParseXmlNavNull");

            XPathNavigator itemNav =
                typeSpecificXml.CreateNavigator().SelectSingleNode("care-plan");

            Validator.ThrowInvalidIfNull(itemNav, "CarePlanUnexpectedNode");

            _name = itemNav.SelectSingleNode("name").Value;
            _startDate = XPathHelper.GetOptNavValue<ApproximateDateTime>(itemNav, "start-date");
            _status = XPathHelper.GetOptNavValue<CodableValue>(itemNav, "status");
            _carePlanManager = XPathHelper.GetOptNavValue<PersonItem>(itemNav, "care-plan-manager");

                // collections
            _careTeam = XPathHelper.ParseXmlCollection<PersonItem>(itemNav, "care-team/person");
            _tasks = XPathHelper.ParseXmlCollection<CarePlanTask>(itemNav, "tasks/task");
            _goalGroups = XPathHelper.ParseXmlCollection<CarePlanGoalGroup>(itemNav, "goal-groups/goal-group");
        }
        /// <summary>
        /// Populates the data from the specified XML.
        /// </summary>
        /// 
        /// <param name="navigator">
        /// The XML containing the medical image study series.
        /// </param>
        /// 
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        /// 
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            if (_acquisitionDateTime == null)
            {
                _acquisitionDateTime = new HealthServiceDateTime();
            }
            _acquisitionDateTime.ParseXml(navigator.SelectSingleNode("acquisition-datetime"));

            _description = XPathHelper.GetOptNavValue(navigator, "description");

            _images.Clear();

            XPathNodeIterator imageIterator = navigator.Select("images");
            foreach (XPathNavigator imageNav in imageIterator)
            {
                MedicalImageStudySeriesImage image = new MedicalImageStudySeriesImage();
                image.ParseXml(imageNav);
                _images.Add(image);
            }
            _institutionName = XPathHelper.GetOptNavValue<Organization>(navigator, "institution-name");
            _referringPhysician = XPathHelper.GetOptNavValue<PersonItem>(navigator, "referring-physician");
            _modality = XPathHelper.GetOptNavValue<CodableValue>(navigator, "modality");
            _bodyPart = XPathHelper.GetOptNavValue<CodableValue>(navigator, "body-part");
            _previewBlobName = XPathHelper.GetOptNavValue(navigator, "preview-blob-name");
            _seriesInstanceUID = XPathHelper.GetOptNavValue(navigator, "series-instance-uid");
        }