f# - 编译错误提示值不是函数

我正在尝试在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

最佳答案

您的弦未正确转义。它应该是:

node.InsertAfter("<Risk type=\"abc1\" methodology=\"xyz1\"/>")

编辑:显然当Brian发布他的答案时,我正在键入此内容。转义每个引号字符或按原样添加@都可以。

https://stackoverflow.com/questions/11436073/

相关文章:

c# - 排序列表>,错误: InvalidOperati

c++ - C++模板泛型(模板参数列表)

objective-c - 架构armv7和Phonegap的 undefined symbol

c# - 'System.Data.Objects.ObjectContext'不包含带有0个参数的

android - 从现有代码创建新项目

boost - 使用复合键从 multi_index_container 中删除每个键的元素

c# - 通用 - 编译器警告 CS0693 或错误

node.js - 编译 Node 给出 “No-old-style-declaration”标志错

c# - “does not contain a static '主要' method”错误

compiler-errors - 为什么 'dsgaudiko'有效的PHP?