自動化のためにmsbuildを使用しています。タスクの 1 つは、テーブルの xml 表現を取得してファイルに書き込む SQL クエリです。だから私は使用しています
<MSBuild.ExtensionPack.SqlServer.SqlExecute
ConnectionString="$(AdminConnectionString)"
Sql="SELECT '%(ReaderResult.Identity)' as XmlFileName,
(SELECT * FROM %(ReaderResult.Identity) FOR XML AUTO, TYPE, ELEMENTS,
XMLSCHEMA('%(ReaderResult.Identity)'), ROOT('DataSet')) as FileContent"
ContinueOnError="false" TaskAction="ExecuteReader">
<Output ItemName="ExportResult" TaskParameter="ReaderResult"/>
</MSBuild.ExtensionPack.SqlServer.SqlExecute>
<WriteLinesToFile File="%(ExportResult.XmlFileName).xml"
Lines="<?xml version="1.0" standalone="yes"?>;
%(ExportResult.FileContent)" Overwrite="true"/>
問題は、読み取り不能、編集困難などの xml データを 1 行で取得することです。
改行とインデントを含む人間が読める xml を取得するにはどうすればよいですか?
ありがとう。