使用XDocument与XmlWriterSettings一起保存时丢失XML格式

使用XDocument与XmlWriterSettings一起保存时丢失XML格式,xml,f#,xsd,linq-to-xml,Xml,F#,Xsd,Linq To Xml,我正在尝试更新XML,但希望保留格式{indenting},而不是插入XmlDeclaration标记。下面是我正在应用的代码片段 让UpdateAndSave(configFileName:string)= 让xmlDoc=XDocument.Load(configFileName) xmlDoc.xpatheevaluate(@“Product/SomeTag/Attr[@type='Value']):?>_ |>序号 |>Seq.iter(乐趣元素->元素添加自我(XElement.Par

我正在尝试更新XML,但希望保留格式{indenting},而不是插入XmlDeclaration标记。下面是我正在应用的代码片段

让UpdateAndSave(configFileName:string)=
让xmlDoc=XDocument.Load(configFileName)
xmlDoc.xpatheevaluate(@“Product/SomeTag/Attr[@type='Value']):?>_
|>序号
|>Seq.iter(乐趣元素->元素添加自我(XElement.Parse(“”))
做
设xmlWriterSettings=新xmlWriterSettings()
xmlWriterSettings.OmitXmlDeclaration=true
xmlWriterSettings.Indent=true
使用(XmlWriter.Create(configFileName,xmlWriterSettings))(有趣的xmlFileWriter->
保存(xmlFileWriter)
)   
配置文件名

更新后,xml格式将完全丢失,并且会插入“XmlDeclaration”标记。我遗漏了什么吗?

在F#中,
=
是比较运算符,而在F#中,
是比较运算符,
=true
(比较)更改为
=true
(比较)更改为