以下のようなxmlファイルがあります
<ScriptFileNames>
<SqlEye>
<ScriptFile Name='_ws_CommandHistory_AllHistory.sql' Type='SP' SqlEyeAnalysisTime='00:00:01.7817594' FxCopAnalysisTime='00:00:00.2253670' FxCopWarningCount='0' SqlEyeWarningCount='2'>
<SqlEyeWarnings>
<SqlEyeWarning message='SD004: Check for existence object then Drop statement before create statement' />
<SqlEyeWarning message='SP001: Set NoCount statement missing or it should be ON.' />
</SqlEyeWarnings>
</ScriptFile>
</SqlEye>
</ScriptFileNames>
出力を
FileName WarningMessage
フォーマット
例えば
_ws_CommandHistory_AllHistory.sql SD004: Check for existence object then Drop statement before create statement
_ws_CommandHistory_AllHistory.sql SP001: Set NoCount statement missing or it should be ON.
私の試み
string input = @"<ScriptFileNames>
<SqlEye>
<ScriptFile Name='_ws_CommandHistory_AllHistory.sql' Type='SP' SqlEyeAnalysisTime='00:00:01.7817594' FxCopAnalysisTime='00:00:00.2253670' FxCopWarningCount='0' SqlEyeWarningCount='2'>
<SqlEyeWarnings>
<SqlEyeWarning message='SD004: Check for existence object then Drop statement before create statement' />
<SqlEyeWarning message='SP001: Set NoCount statement missing or it should be ON.' />
</SqlEyeWarnings>
</ScriptFile>
</SqlEye>
</ScriptFileNames>";
XDocument doc = XDocument.Parse(input);
XElement scriptFileNames = doc.Element("ScriptFileNames");
var xx = (from x1 in scriptFileNames.Element("SqlEye").Elements("ScriptFile")
select new
{
Name = x1.Attribute("Name").Value
}).ToList();
私はまた、より多くのセクションを持っています
<SqlEyeRemarks>
<SqlEyeRemark message='SD001: Set QuotedIdentifier ON statement is missing or order mismatch or it should be ON.' />
<SqlEyeRemark message='SD002: Set AnsiiNullsOn ON statement is missing or order mismatch or it should be ON.' />
<SqlEyeRemark message='SD009: Missing or order mismatch of Grant statement.' />
</SqlEyeRemarks>
どうすれば彼らを仲良くさせることができますか?