Horje
c# validate xml Code Example
c# validate xml
using (FileStream stream = File.OpenRead(xsdFilepath))
{
    XmlReaderSettings settings = new XmlReaderSettings();

    XmlSchema schema = XmlSchema.Read(stream, OnXsdSyntaxError);
    settings.ValidationType = ValidationType.Schema;
    settings.Schemas.Add(schema);
    settings.ValidationEventHandler += OnXmlSyntaxError;

    using (XmlReader validator = XmlReader.Create(xmlPath, settings))
    {
        // Validate the entire xml file
        while (validator.Read()) ;
    }
}
// The OnXmlSyntaxError function will be called when a syntax error occur.




Csharp

Related
system.drawing.color to system.consolecolor Code Example system.drawing.color to system.consolecolor Code Example
c# nunit test case Code Example c# nunit test case Code Example
How to execute script in C# Code Example How to execute script in C# Code Example
c# insert character into string at position Code Example c# insert character into string at position Code Example
value is null to insert in c# Code Example value is null to insert in c# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8