Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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.
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# compare dateTime with string 
Csharp :: for statement syntax C sharp 
Csharp :: c# check characters in string 
Csharp :: csharp Console.Read(); 
Csharp :: c# get random between 0 and 1 
Csharp :: .net json result status code not working 
Csharp :: context.Response.Body read stream .net 
Csharp :: select specific columns from datatable in c# using lambda 
Csharp :: run in new thread C# 
Csharp :: unity dropdown 
Csharp :: c# open access database mdb 
Csharp :: wpf textbox insert text at caret position 
Csharp :: unity draw waypoins path 
Csharp :: conncet oracle database in c# visual studio 
Csharp :: how to detect ajax request in asp.net core 
Csharp :: unity collision.impulse 
Csharp :: get gameobject active state 
Csharp :: Send Hotmail, Outlook, Office365 Email using SMTP C# .NET 
Csharp :: c# dictionary check if value exists 
Csharp :: regex only letters and numbers c# 
Csharp :: KeyValuePair is default 
Csharp :: raq query ef core 
Csharp :: asp net core dependency injection factory with parameters 
Csharp :: if statement in razor using "?" and ":" 
Csharp :: unity navmeshagent set destination 
Csharp :: foreach for IEnumerable 
Csharp :: c# convert xml to list string 
Csharp :: instantiate c# 
Csharp :: instantiate object inside of object Unity 
Csharp :: animation not playing unity 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =