/// <summary> /// Parses the common portions of the extension data. /// </summary> /// /// <param name="extensionNav"> /// The XML to get the extension data from. /// </param> /// internal void ParseXml(XPathNavigator extensionNav) { _source = extensionNav.GetAttribute("source", string.Empty); Version = extensionNav.GetAttribute("ver", string.Empty); string logoString = extensionNav.GetAttribute("logo", string.Empty); if (!string.IsNullOrEmpty(logoString)) { Logo = new Uri(logoString); } string transformString = extensionNav.GetAttribute("xsl", string.Empty); if (!string.IsNullOrEmpty(transformString)) { Transform = new Uri(transformString); } // Save off the data in its entirety _extensionData = SDKHelper.SafeLoadXml(extensionNav.OuterXml); // Call the derived class for parsing. ParseXml(ExtensionData); }
/// <summary> /// Populates the class members with data from the specified /// person information XML. /// </summary> /// /// <param name="navigator"> /// The XML to get the person information from. /// </param> /// internal virtual void ParseXml(XPathNavigator navigator) { _personId = new Guid(navigator.SelectSingleNode("person-id").Value); Name = navigator.SelectSingleNode("name").Value; XPathNavigator navAppSettings = navigator.SelectSingleNode("app-settings"); if (navAppSettings != null) { XDocument doc = SDKHelper.SafeLoadXml(navAppSettings.OuterXml); ApplicationSettingsDocument = doc; } XPathNavigator navSelectedRecordId = navigator.SelectSingleNode("selected-record-id"); if (navSelectedRecordId != null) { _selectedRecordId = new Guid(navSelectedRecordId.Value); } XPathNavigator navPreferredCulture = navigator.SelectSingleNode("preferred-culture[language != '']"); if (navPreferredCulture != null) { PreferredCulture = null; XPathNavigator navLanguageCode = navPreferredCulture.SelectSingleNode("language"); { PreferredCulture = navLanguageCode.Value; // Country code only matters if the language code is present. XPathNavigator navCountryCode = navPreferredCulture.SelectSingleNode("country"); if (navCountryCode != null) { PreferredCulture += "-" + navCountryCode.Value; } } } XPathNavigator navPreferredUICulture = navigator.SelectSingleNode("preferred-uiculture[language != '']"); if (navPreferredUICulture != null) { PreferredUICulture = null; XPathNavigator navLanguageCode = navPreferredUICulture.SelectSingleNode("language"); { PreferredUICulture = navLanguageCode.Value; // Country code only matters if the language code is present. XPathNavigator navCountryCode = navPreferredUICulture.SelectSingleNode("country"); if (navCountryCode != null) { PreferredUICulture += "-" + navCountryCode.Value; } } } XPathNavigator locationNav = navigator.SelectSingleNode("location"); if (locationNav != null) { Location = new Location(); Location.ParseXml(locationNav); } XPathNodeIterator recordsNav = navigator.Select("record"); foreach (XPathNavigator recordNav in recordsNav) { // Now see if we can fill in the record information HealthRecordInfo record = HealthRecordInfo.CreateFromXml(recordNav); if (record != null) { AuthorizedRecords.Add(record.Id, record); } } XPathNavigator navMoreRecords = navigator.SelectSingleNode("more-records"); if (navMoreRecords != null) { HasMoreRecords = true; } XPathNavigator navMoreAppSettings = navigator.SelectSingleNode("more-app-settings"); if (navMoreAppSettings != null) { HasMoreApplicationSettings = true; } }