Validating XML using UBL XSD
I am trying to learn using UBL 2.1 xml specificaton because our company is looking into integrating it with our CRM software. Right now I sampled creating a class out of UBL-Invoice-2.1.xsd and was able to create and open xml document using that class. The problem that I am trying to ask is with regards to validation, I tried to validate the simple xml file I've generated and the sample xml from UBL(UBL-Invoice-2.1-Example) and I keep getting warnings "Could not find schema information for the element 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2'".
Here is the sample code I used in C# to validate xml against xsd:
XmlSchemaSet schemaSet = new XmlSchemaSet();
XmlSchema compiledSchema = null;
//add all imported schemas in Invoice-2.1 xsd
foreach (XmlSchema schema in schemaSet.Schemas())
compiledSchema = schema;
XmlReaderSettings xmlreadSet = new XmlReaderSettings();
xmlreadSet.ValidationType = ValidationType.Schema;
xmlreadSet.ValidationFlags |= XmlSchemaValidationFlags.ProcessInlineSchema;
xmlreadSet.ValidationFlags |= XmlSchemaValidationFlags.ProcessSchemaLocation;
xmlreadSet.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
xmlreadSet.ValidationFlags |= XmlSchemaValidationFlags.ProcessIdentityConstraints;
xmlreadSet.ValidationEventHandler += new ValidationEventHandler(XmlValidationEventHandler);
XmlReader xread = XmlReader.Create(openDialog.OpenFile(), xmlreadSet);
I have added all the schemas included in the Invoice-2.1.xsd and I have used the sample xml from UBL(which I think should be complete) but im still getting those warnings. If anyone can point out anything that I am doing wrong that would be great.
Thanks in advance.