private static void ProcessSetElement(XElement element, StringIDSetResolver resolver) { int id = XMLUtil.GetNumericAttribute(element, "id"); int min = XMLUtil.GetNumericAttribute(element, "min", 0); int globalIndex = XMLUtil.GetNumericAttribute(element, "startIndex"); resolver.RegisterSet(id, min, globalIndex); }
/// <summary> /// Loads stringID set definitions from an XML document. /// </summary> /// <param name="document">The XML document to load set definitions from.</param> /// <returns>The StringIDSetResolver that was created.</returns> public static StringIDSetResolver LoadStringIDSets(XDocument document) { // Make sure there is a root <stringIDs> tag XElement container = document.Element("stringIDs"); if (container == null) { throw new ArgumentException("Invalid stringID definition document"); } StringIDLayout idLayout = ProcessIDLayoutInfo(container); // Process <set> elements var resolver = new StringIDSetResolver(idLayout); foreach (XElement element in container.Elements("set")) { ProcessSetElement(element, resolver); } return(resolver); }