我試圖將兩個XmlDocument.xml
用於WebAPI 2.0文檔。但是當我執行下面的代碼時,它會返回< /doc>
而不會出錯。看起來我一切正常,所以我有點困惑。 printf
聲明在哪裏,這是失敗的結果值。代碼似乎在完美工作之前和之後。XML類型提供程序創建新的XML對象失敗
#r "../packages/FSharp.Data.2.2.5/lib/net40/FSharp.Data.dll"
#r "System.Xml.Linq.dll"
open FSharp.Data
open System.IO
// Define your library scripting code here
let seedPath = __SOURCE_DIRECTORY__ + "../../FieldOps/bin"
let outFile = __SOURCE_DIRECTORY__ + "../../FieldOps/App_Data/XmlDocument.xml"
type XmlDocument = XmlProvider<"""<?xml version="1.0"?>
<doc>
<assembly><name>lala</name></assembly>
<members>
<member name="">
<summary>lala</summary>
<param name="">lala</param>
<param name="">lala</param>
<returns>lala</returns>
</member>
<member name=""></member>
</members>
</doc>
""">
let xmlPaths =
[
"../bin/Release"
]
let seed = XmlDocument.Load(Path.Combine(seedPath, "XmlDocument.xml"))
let addFile path = Path.Combine(path, "XmlDocument.XML")
let loadXmlDoc (path: string) = XmlDocument.Load(path)
let joinXmlDocuments (acc: XmlDocument.Doc) path =
let doc = (addFile >> loadXmlDoc) path
let members = Array.append acc.Members doc.Members
let result = new XmlDocument.Doc(acc.Assembly, members)
printf "result ------------------- %A --------------------" result
result
let joinedDocs =
xmlPaths
|> List.fold (joinXmlDocuments) seed
let xml = joinedDocs.XElement.ToString()
File.WriteAllText(outFile, xml)
有什麼錯誤? –
沒有任何錯誤。它只是用'< /doc>'來代替所有數據。 – Jon49