+ private void LookupRegions ()
+ {
+ XPathDocument doc = GetXPathDocument ("supplementalData.xml");
+ XPathNavigator nav = doc.CreateNavigator ();
+ XPathNodeIterator ni = nav.Select ("supplementalData/currencyData/region");
+ while (ni.MoveNext ()) {
+ string territory = (string) ni.Current.GetAttribute ("iso3166", String.Empty);
+ string currency = (string) ni.Current.Evaluate ("string(currency/@iso4217)");
+ RegionInfoEntry region = new RegionInfoEntry ();
+ region.ISO2Name = territory.ToUpper ();
+ region.ISOCurrencySymbol = currency;
+ regions [territory] = region;
+ }
+
+ doc = GetXPathDocument ("langs/en.xml");
+ nav = doc.CreateNavigator ();
+ ni = nav.Select ("/ldml/localeDisplayNames/territories/territory");
+ while (ni.MoveNext ()) {
+ RegionInfoEntry r = (RegionInfoEntry)
+ regions [ni.Current.GetAttribute ("type", "")];
+ if (r == null)
+ continue;
+ r.EnglishName = ni.Current.Value;
+ }
+
+ Hashtable curNames = new Hashtable ();
+ ni = nav.Select ("/ldml/numbers/currencies/currency");
+ while (ni.MoveNext ())
+ curNames [ni.Current.GetAttribute ("type", "")] =
+ ni.Current.Evaluate ("string (displayName)");
+
+ foreach (RegionInfoEntry r in regions.Values)
+ r.CurrencyEnglishName =
+ (string) curNames [r.ISOCurrencySymbol];
+ }
+