I want to validate XML documents against xsds with includes and imports, without includes and imports this code work. These are 4 xsds used to validate xml. Main.xsd <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:ord="http://NamespaceTest.com/OrderTypes" xmlns:pur="http://NamespaceTest.com/Purchase" xmlns:cmn="http://NamespaceTest.com/CommonTypes" xmlns:cust="http://NamespaceTest.com/CustomerTypes" targetNamespace="http://NamespaceTest.com/Purchase" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:import schemaLocation="CommonTypes.xsd" namespace="http://NamespaceTest.com/CommonTypes" /> <xs:import schemaLocation="CustomerTypes.xsd" namespace="http://NamespaceTest.com/CustomerTypes" /> <xs:import schemaLocation="OrderTypes.xsd" namespace="http://NamespaceTest.com/OrderTypes" [...] read more
I have to read an XML from file, which is: <?xml version="1.0" encoding="UTF-16"?> <KyactusProfileClass xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <username>sadasdsad</username> <userid>0067AA87BF9AD466792E1A20F6AAB7F</userid> <useDefaultFolder>false</useDefaultFolder> <autoAcceptDownloads>false</autoAcceptDownloads> <visible>false</visible> </KyactusProfileClass> I read it using following code: using (var xmlReader = XmlReader.Create(pathXML)) { Console.WriteLine(File.ReadAllText(pathXML)); schemas.Add(null, xmlReader); } But I get following error: > System.Xml.Schema.XmlSchemaException: 'The root element of W3C [...] read more