Xml FSI缓存了一些不需要的东西?

Xml FSI缓存了一些不需要的东西?,xml,f#,f#-interactive,Xml,F#,F# Interactive,我在F#中有一些代码,用于根据模式验证XML。代码如下: 模块IA.helperscript.ValidateXmlSchema 开放系统 开放系统.Xml open System.Xml.Schema 让字典=\源\目录__ 让solutionPath=dictionary.Substring(0,dictionary.LastIndexOf('\\',dictionary.LastIndexOf('\\')-1)) 设schemaFolder=solutionPath+“\\Schemas”

我在F#中有一些代码,用于根据模式验证XML。代码如下:

模块IA.helperscript.ValidateXmlSchema
开放系统
开放系统.Xml
open System.Xml.Schema
让字典=\源\目录__
让solutionPath=dictionary.Substring(0,dictionary.LastIndexOf('\\',dictionary.LastIndexOf('\\')-1))
设schemaFolder=solutionPath+“\\Schemas”
让errorMessages=new System.Text.StringBuilder()
让schemaset=newxmlschemaset()
let LoadSchema(schemaPath:string)(schemaset:XmlSchemaSet)=
使用stream=newstreamreader(schemaPath)
使用xmlReader=xmlReader.Create(流)
让schema=XmlSchema.Read(xmlReader,null)
schemas.Add(schema)
让我们验证(xmlPath:string)=
对于目录.GetFiles(schemaFolder)中的schemaPath
LoadSchema schemaPath模式|>忽略
let settings=new XmlReaderSettings()
设置(忽略模式)
使用xmlStream=newstreamreader(xmlPath)
使用xmlReader=xmlReader.Create(xmlStream,设置)
let document=new XmlDocument()
document.Load(xmlReader)|>忽略
let result=errorMessages.ToString()
匹配结果
|当r.长度>0->printfn“错误:\r\n%s”结果时
|->printfn“验证通过”
我还有另一个fsx文件,它加载在fs文件之上并执行validate函数。代码如下:

#加载“ValidateXmlSchema.fs”
开放系统。反射
open System.Collections.Generic

fsi.ShowDeclarationValues每次调用
Validate
,它都会调用
LoadSchema
,这会将架构添加到
架构中。因此,如果两次调用
Validate
schemas
将包含同一模式的两个副本。难怪会出现错误。

在我看来,您似乎将在该特定文件夹中找到的所有文件都添加为模式-并且两个(或更多)似乎共享一个
PartnerFeed
定义-不要认为这与F#-交互式或根元素有任何关系-为什么不调试它呢(例如,输入一些
printfn
进行日志记录,或者直接将其放入控制台应用程序并使用VS进行调试)是的,这是根本原因。非常感谢。