jjzjj

ValidatingReader

全部标签

c# - C# 中的 MemoryStream 导致 Xml 模式验证失败

这是我的功能。如果您将MemoryStream传递给XmlReader,它有时不会验证正确的xml文件。我将XmlDocument对象存储在内存中,我想根据最终用户提供的xsd架构文件对其进行验证。ValidateSchema1(stringXMLPath,stringXSDPath){XmlDocumentxmlDocument=newXmlDocument();xmlDocument.Load(XMLPath);using(MemoryStreammstream=newMemoryStream()){//StreamWriterwriter=newStreamWriter(mstr