/// <summary> /// Sets all basis vector names to "", then handle XML attributes (nameX = "..") and then checks if all names have been set. /// </summary> private static void ParseBasisVectorNamesAttributes(Specification S, XmlAttributeCollection A) { // reset all names to "" for (int i = 0; i < S.m_basisVectorNames.Count; i++) S.m_basisVectorNames[i] = ""; // handle all attributes for (int i = 0; i < A.Count; i++) { if (!A[i].Name.StartsWith(XML_NAME)) throw new G25.UserException("XML parsing error: Invalid attribute '" + A[i].Name + "' in element '" + XML_BASIS_VECTOR_NAMES + "'."); int idx; try { idx = System.Int32.Parse(A[i].Name.Substring(XML_NAME.Length)) - 1; } catch (System.Exception) { throw new G25.UserException("XML parsing error: Invalid attribute '" + A[i].Name + "' in element '" + XML_BASIS_VECTOR_NAMES + "'."); } S.SetBasisVectorName(idx, A[i].Value); } // check if all have been set S.CheckBasisVectorNames(); }