必要なユーティリティ ツールの 1 つを F# で実験しようとしています。そこでは、xml ファイルのフォルダーをトロールし、特定のタグを探します。見つかった場合は、別の同様のタグを一緒に挿入します。最後に、そのような追加のタグが挿入されたすべてのファイル名を出力します。しかし、コンパイルエラーが発生しています。これについてはあまり意味がありません。
let configFile =
Directory.GetFiles(Path.Combine("rootdir", "relativepath"), @"*.xml")
|> Seq.map(fun configFileName ->
let xmlNavigator = XPathDocument(configFileName).CreateNavigator()
let node = xmlNavigator.SelectSingleNode(@"Product/ABc[@type='xyz']")
match node with
| null -> "not configuration present"
| _ ->
let nodeAppender() = node.InsertAfter("<Risk type=""abc1"" methodology=""xyz1""/>")
let parentNode = node.SelectAncestors(XPathNodeType.Root, false)
parentNode.Current.OuterXml)
|> Seq.iter (printfn "%s")
コンパイルエラーは次のとおりです。
This value is not a function and cannot be applied