Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用C#中的XSD字符串验证XmlDocument?_C#_Xml_Validation_Xsd_Xmldocument - Fatal编程技术网

使用C#中的XSD字符串验证XmlDocument?

使用C#中的XSD字符串验证XmlDocument?,c#,xml,validation,xsd,xmldocument,C#,Xml,Validation,Xsd,Xmldocument,我有一个C语言的XmlDocument,需要根据Xml模式进行验证。我看过很多关于如何使用XmlDocument.Schemas.Add(namspace,xsdfilename)实现这一点的文章,但是我的XSD并没有保存在磁盘上,而是保存在内存中(从数据库加载)。有谁能给我指点一下如何用XSD字符串验证XmlDocument? using (StringReader stringReader = new StringReader(xsdString)) using (XmlTextReader

我有一个C语言的
XmlDocument
,需要根据Xml模式进行验证。我看过很多关于如何使用
XmlDocument.Schemas.Add(namspace,xsdfilename)
实现这一点的文章,但是我的XSD并没有保存在磁盘上,而是保存在内存中(从数据库加载)。有谁能给我指点一下如何用XSD字符串验证
XmlDocument
using (StringReader stringReader = new StringReader(xsdString))
using (XmlTextReader xmlReader = new XmlTextReader(stringReader))
{
    xmlDocument.Schemas.Add(null, xmlReader);
}