public void Execute() { Console.WriteLine("start."); Console.WriteLine(); LoadTables(CsvDir); //検証結果一覧tsvを生成 GenerateTestResultTsv(); // 説明XML/HTMLを保存、 foreach (AsDescriptionTable adt in AsDescriptionTables) { FileInfo outputFile = GetFileInfo(OutputXmlDir, adt.Name + ".xml"); XmlDocument xml = adt.ToXml(); XmlNode scResult = SuccessCriteriaTable.GetSuccessCriteriaInfo(xml, adt.Name); xml.DocumentElement.PrependChild(scResult); SaveXml(xml, outputFile); SaveAllChildren(adt); FileInfo indexHtml = GetFileInfo(OutputHtmlDir, adt.Name + ".html"); CreateHtml("index", xml, indexHtml); } // カバーページHTMLを保存 var criteriaXml = SuccessCriteriaTable.ToXml(); SaveXml(criteriaXml, GetFileInfo(OutputXmlDir, "success-criteria.xml")); CreateHtml("cover", criteriaXml, GetFileInfo(OutputHtmlDir, "index.html")); Console.WriteLine(); Console.WriteLine("done."); }
// DescriptionのXML/HTMLをすべてSaveします。 public void SaveAllChildren(AsDescriptionTable adt) { foreach (DataRow row in adt.Rows) { string id = row[AsDescriptionTable.IdColumnName].ToString(); XmlDocument xml = new XmlDocument() { XmlResolver = null }; XmlElement root = xml.CreateElement("description"); xml.AppendChild(root); // 達成基準の情報を追加 // ほかの達成基準からも参照されている可能性があるので全てのテーブルを見る int count = 0; foreach (AsDescriptionTable otherAdt in AsDescriptionTables) { DataRow r = otherAdt.Rows.Find(id); if (r != null) { XmlElement successCriteriaElement = xml.CreateElement("successCriteria"); XmlNode scResult = SuccessCriteriaTable.GetSuccessCriteriaInfo(xml, otherAdt.Name); root.AppendChild(scResult); count++; } } if (count > 1) { Console.WriteLine("multiple use: {0} ", id); } string testType = GetTestTypeById(id); if (testType != null) { XmlElement testTypeElement = xml.CreateElement("testType"); testTypeElement.InnerText = testType; root.AppendChild(testTypeElement); } root.AppendChild(adt.RowToXml(row, xml)); XmlElement testDetail = xml.CreateElement("testDetail"); XmlNode testDetailNode = GetTestDetail(id, xml); if (testDetail != null) { testDetail.AppendChild(testDetailNode); root.AppendChild(testDetail); } else { Console.Error.WriteLine("testDetailが取得できませんでした : {0}", id); } FileInfo outputXml = GetFileInfo(OutputXmlDir, id + ".xml"); SaveXml(xml, outputXml); FileInfo outputHtml = GetFileInfo(OutputHtmlDir, id + ".html"); CreateHtml("doc", xml, outputHtml); } }