Hi,
I am using an xml schema (Schema1.xsd) which refers to two other
Schemas as follows.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:plcm-s="http://www.mycompany.com/plcm"
targetNamespace="http://www.mycompany.com/plcm"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:include schemaLocation="Schema2.xsd"/>
<xsd:include schemaLocation="Schema3.xsd"/>
All three schemas are stored in a Database as strings (SQL Server
2000).
Now I am trying to load the Schema1 from datbase by using the following
code.
public XmlSchema GetSchema()
{
XmlSchema PLCMSchema = null;
String schema1StringFromDatabase=//Get Schema1 from
Database
String schema2StringFromDatabase=//Get Schema2 from
Database
String schema3StringFromDatabase=//Get Schema3 from
Database
try
{
TextReader schemaTextReader = new
StringReader(schema1StringFromDatabase) as TextReader;
XmlTextReader schemaXmlReader = new
XmlTextReader(schemaTextReader);
XmlSchema schemaPLCM = XmlSchema.Read(schemaXmlReader,
new ValidationEventHandler(schemaSet_ValidationEventHa ndler));
XmlSchemaSet schemaset = new XmlSchemaSet();
schemaset.ValidationEventHandler += new
ValidationEventHandler(schemaSet_ValidationEventHa ndler);
schemaset.Add(schemaPLCM);
schemaset.Compile();
foreach (XmlSchema schema in schemaset.Schemas())
{
PLCMSchema = schema;
}
}
catch (Exception exception)
{
System.Windows.Forms.MessageBox.Show("Error in
PLCMWorkbenchShared.GetSchema()" + System.Environment.NewLine +
exception.Message);
}
return PLCMSchema;
}
But the SchemaSet_ValidationEventHandler Returns the error "Cannot
resolve the schemaLocation attribute".
Is there any way I can load the Schema1 from Database without errors
(the other two schemas are also in database)?
Any help is greatly appreciated.
Thanks,
Ramesh