Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get XmlSchema object from XSD which is string in C#?

Tags:

string

c#

xml

xsd

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

like image 890
eomeroff Avatar asked Oct 22 '10 17:10

eomeroff


2 Answers

The Read method is static. So better use

XmlSchema schema = XmlSchema.Read(
    schemaReader, (sender, args) =>
    {
         // HANDLE VALIDATION FAILED
    });                                                                        
like image 177
tmanthey Avatar answered Sep 25 '22 23:09

tmanthey


You can use a StringReader:

string content = ".......";
XmlSchema schema = XmlSchema.Read(new StringReader(content), ValidateSchema);
like image 39
Frédéric Hamidi Avatar answered Sep 22 '22 23:09

Frédéric Hamidi