Since schema2 and schema3 are resources in the database, the schema set's
default XmlResolver (XmlUrlResolver) will not know how to get them.
1. Set XmlResolver property on XmlSchemaSet to null and add schema1 to set.
objects as includes. Then call compile()
2. You can use a custom resolver that returns back the schema objects from
"techie" <ramesh.net007@gmail.com> wrote in message
news:1148986609.476684.146590@g10g2000cwb.googlegroups.com...
> 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_ValidationEventHandler));
>
> XmlSchemaSet schemaset = new XmlSchemaSet();
> schemaset.ValidationEventHandler += new
> ValidationEventHandler(schemaSet_ValidationEventHandler);
> 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
>