I'm trying to validate an XDocument with a compiled schema that I have (which works) but when I try to access PSVI for the root XElement it returns null. I need this so I can validate child XElements.
Here is a sample code of what I'm trying to do:
XDocument xmlDoc = XDocument.Load(xmlFilePath);
XElement root = _xmlDoc.Elements().Single();
XmlSchemaSet schemas = new XmlSchemaSet();
schemas.Add(schema);
xmlDoc.Validate(schemas, ValidationEventHandler);
XmlSchemaElement se = xmlDoc.Elements().Single().GetSchemaInfo();
I can see that validation for XDocument works, I catch ValidationEvents and all.
All thoughts are appreciated. Thank you.