public RulesetGroupTest() { var xml = Cldr.Instance .GetDocuments("common/rbnf/en.xml") .FirstElement("ldml/rbnf/rulesetGrouping"); spelloutRules = RulesetGroup.Parse(xml); }
/// <summary> /// Create a rule set group from the specified <see cref="XPathNavigator"/>. /// </summary> /// <param name="xml"> /// The XML representation of a rule set group. /// </param> /// <returns> /// A new rule set group. /// </returns> /// <remarks> /// The <paramref name="xml"/> must be on an "rulesetGrouping" element. /// </remarks> public static RulesetGroup Parse(XPathNavigator xml) { if (log.IsDebugEnabled) { log.Debug("Parsing RBNF from " + xml.BaseURI); } var group = new RulesetGroup { Type = xml.GetAttribute("type", ""), }; var rulesets = new Dictionary <string, Ruleset>(); var children = xml.SelectChildren("ruleset", ""); while (children.MoveNext()) { var ruleset = Ruleset.Parse(children.Current); rulesets.Add(ruleset.Type, ruleset); } group.Rulesets = rulesets; return(group); }