private XmlSchemaSet addToSchemaSet(XmlSchemaObject xmlSchemaObject, XmlSchemaSet xmlSchemaSet )
{
if (xmlSchemaObject is XmlSchemaInclude)
{
XmlSchemaInclude include = (XmlSchemaInclude)xmlSchemaObject;
if (include.Schema == null)
{
XmlReaderSettings settings = new XmlReaderSettings();
settings.DtdProcessing = DtdProcessing.Ignore;
string dataPath = Path.Combine(AppConfiguration.DataPath, "Temp", userName, include.SchemaLocation.Split('/').Last());
XmlReader test = XmlReader.Create(dataPath, settings);
include.Schema = XmlSchema.Read(test, verifyErrors);
}
xmlSchemaSet.Add(include.Schema);
additionalFiles.Add(Path.GetFileName(include.Schema.SourceUri.ToString()));
// if schema has included schemas
if (include.Schema.Includes.Count > 0)
{
foreach (XmlSchemaObject additional in include.Schema.Includes)
{
addToSchemaSet(additional, xmlSchemaSet);
}
}
return xmlSchemaSet;
}
return xmlSchemaSet;
}