如何从XSD获取XmlSchema对象,这是C#中的字符串?

时间:2021-11-12 21:36:06

How to get XmlSchema object from large string that contains all XSD content?

如何从包含所有XSD内容的大字符串中获取XmlSchema对象?

2 个解决方案

#1


9  

You can use a StringReader:

您可以使用StringReader:

string content = ".......";
XmlSchema schema = new XmlSchema();
schema.Read(new StringReader(content), ValidateSchema);

#2


22  

The Read method is static. So better use

Read方法是静态的。所以更好用

XmlSchema schema = XmlSchema.Read(
    schemaReader, (sender, args) =>
    {
         // HANDLE VALIDATION FAILED
    });                                                                        

#1


9  

You can use a StringReader:

您可以使用StringReader:

string content = ".......";
XmlSchema schema = new XmlSchema();
schema.Read(new StringReader(content), ValidateSchema);

#2


22  

The Read method is static. So better use

Read方法是静态的。所以更好用

XmlSchema schema = XmlSchema.Read(
    schemaReader, (sender, args) =>
    {
         // HANDLE VALIDATION FAILED
    });