private XmlSchema GetChameleonSchema(string targetNamespace, XmlSchema schema) {
ChameleonKey cKey = new ChameleonKey(targetNamespace, schema.BaseUri);
XmlSchema chameleonSchema = (XmlSchema)chameleonSchemas[cKey]; //Need not clone if a schema for that namespace already exists
if (chameleonSchema == null) {
chameleonSchema = schema.DeepClone(); //It is ok that we dont lock the clone since no one else has access to it yet
chameleonSchema.IsChameleon = true;
chameleonSchema.TargetNamespace = targetNamespace;
chameleonSchemas.Add(cKey, chameleonSchema);
//Handle the original schema that was added to lockList before cloning occurred
schema.IsProcessing = false; //Since we cloned it for the chameleon
}
return chameleonSchema;
}