Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit a594b5cd authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

XML Validation: check if schema-info is set, i.e. XML is according to a known schema

parent 0e0b1e2b
No related branches found
No related tags found
No related merge requests found
......@@ -78,12 +78,15 @@ namespace TUGraz.VectoCore.Utils
throw new Exception("empty XML document");
}
var xsdType = _doc.DocumentElement.Attributes?.GetNamedItem("type", "http://www.w3.org/2001/XMLSchema-instance")
?.InnerText;
_doc.Schemas = GetXMLSchema(docType, xsdType);
_doc.Validate(ValidationCallBack);
_doc.Schemas = GetXMLSchema(docType);
_doc.Validate(ValidationCallBack);
if (_doc.SchemaInfo.Validity != XmlSchemaValidity.Valid || _doc.DocumentElement?.SchemaInfo == null ||
_doc.DocumentElement.SchemaInfo.SchemaType == null) {
_valid = false;
}
return _valid;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment