public static UnicodeTestCases LoadUnicodeCharMappingsFromFile(string fPath) { XmlDocument doc = new XmlDocument(); UnicodeTestCases list = new UnicodeTestCases(); try { doc.Load(fPath); } catch (FileNotFoundException e) { Trace.WriteLine(String.Format("Error opening XML document contained test cases: Error {0}", e.Message)); } //Parsing into structures.. try { foreach (XmlNode node in doc.SelectNodes("/UnicodeTestMappings/UnicodeTestMapping")) { UnicodeTestCaseTypes t = UAUtilities.GetMappingTypeFromString(node.Attributes["Type"].Value); switch (t) { case UnicodeTestCaseTypes.Transformable: list.Add(ParseTransformable(node)); break; case UnicodeTestCaseTypes.Traditional: list.Add(ParseTraditional(node)); break; case UnicodeTestCaseTypes.Overlong: list.Add(ParseOverlong(node)); break; } } } catch (Exception e) { Trace.WriteLine(String.Format("Error parsing XML Document {0]", e.Message)); throw e; } return(list); }
public UnicodeTestCases GetAll() { UnicodeTestCases ret = new UnicodeTestCases(); foreach (UnicodeTestCase mapping in this) { ret.Add(mapping); } return(ret); }
public UnicodeTestCases GetMappingsByType(UnicodeTestCaseTypes type) { UnicodeTestCases ret = new UnicodeTestCases(); foreach (UnicodeTestCase mapping in this) { if (mapping.Type == type) { ret.Add(mapping); } } return(ret); }