3
I’m trying to validate the values of a XML
through a file XSD
. I’m trying it this way:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(xmlReader);
ValidationEventHandler eventHandler = new ValidationEventHandler(ValidationEventHandler);
xmlDoc.Schemas.Add(schemaSet);
xmlDoc.Validate(eventHandler);
static void ValidationEventHandler(object sender, ValidationEventArgs e)
{
switch (e.Severity)
{
case XmlSeverityType.Error:
Console.WriteLine("Error: {0}", e.Message);
break;
case XmlSeverityType.Warning:
Console.WriteLine("Warning {0}", e.Message);
break;
}
}
But when debugging and executing the xmlDoc.Validate(eventHandler)
get the following error:
The 'http://www.w3.org/2000/09/xmldsig#:Signature' element is not declared.
I’ve looked in several places and I can’t solve the problem; How can I solve this problem?
I had put in the title, someone edited, I am using C#, as for XML I could not post because it is too big
– user3739007
Only one question, what is the value of
schemaSet
? Or whatever Schema you use?– Marconi