public override bool Equals(object obj) { if (Ref.ReferenceEquals(this, obj)) { return(true); } ChameleonKey cKey = obj as ChameleonKey; if (cKey != null) { return(this.targetNS.Equals(cKey.targetNS) && this.chameleonLocation.Equals(cKey.chameleonLocation)); } return(false); }
public override bool Equals(object obj) { if (object.ReferenceEquals(this, obj)) { return(true); } ChameleonKey key = obj as ChameleonKey; if (key == null) { return(false); } return((this.targetNS.Equals(key.targetNS) && this.chameleonLocation.Equals(key.chameleonLocation)) && object.ReferenceEquals(this.originalSchema, key.originalSchema)); }
public override bool Equals(object obj) { if (Ref.ReferenceEquals(this, obj)) { return(true); } ChameleonKey cKey = obj as ChameleonKey; if (cKey != null) { // We want to compare the target NS and the schema location. // If the location is empty (but only then) we also want to compare the original schema instance. // As noted above the originalSchema is null if the chameleonLocation is non-empty. As a result we // can simply compare the reference to the original schema always (regardless of the schemalocation). Debug.Assert((chameleonLocation.OriginalString.Length == 0 && originalSchema != null) || (chameleonLocation.OriginalString.Length != 0 && originalSchema == null)); return(this.targetNS.Equals(cKey.targetNS) && this.chameleonLocation.Equals(cKey.chameleonLocation) && Ref.ReferenceEquals(originalSchema, cKey.originalSchema)); } return(false); }
internal XmlSchema FindSchemaByNSAndUrl(Uri schemaUri, string ns, DictionaryEntry[] locationsTable) { if ((schemaUri != null) && (schemaUri.OriginalString.Length != 0)) { XmlSchema originalSchema = null; if (locationsTable == null) { originalSchema = (XmlSchema)this.schemaLocations[schemaUri]; } else { for (int i = 0; i < locationsTable.Length; i++) { if (schemaUri.Equals(locationsTable[i].Key)) { originalSchema = (XmlSchema)locationsTable[i].Value; break; } } } if (originalSchema == null) { return(originalSchema); } string str = (originalSchema.TargetNamespace == null) ? string.Empty : originalSchema.TargetNamespace; if (str == ns) { return(originalSchema); } if (str == string.Empty) { ChameleonKey key = new ChameleonKey(ns, originalSchema); return((XmlSchema)this.chameleonSchemas[key]); } } return(null); }
private XmlSchema GetChameleonSchema(string targetNamespace, XmlSchema schema) { ChameleonKey key = new ChameleonKey(targetNamespace, schema); XmlSchema schema2 = (XmlSchema) this.chameleonSchemas[key]; if (schema2 == null) { schema2 = schema.DeepClone(); schema2.IsChameleon = true; schema2.TargetNamespace = targetNamespace; this.chameleonSchemas.Add(key, schema2); schema2.SourceUri = schema.SourceUri; schema.IsProcessing = false; } return schema2; }
private XmlSchema GetChameleonSchema(string targetNamespace, XmlSchema schema) { ChameleonKey cKey = new ChameleonKey(targetNamespace, schema); 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); chameleonSchema.SourceUri = schema.SourceUri; //Handle the original schema that was added to lockList before cloning occurred schema.IsProcessing = false; //Since we cloned it for the chameleon } return chameleonSchema; }
internal XmlSchema FindSchemaByNSAndUrl(Uri schemaUri, string ns, DictionaryEntry[] locationsTable) { if (schemaUri == null || schemaUri.OriginalString.Length == 0) { return null; } XmlSchema schema = null; if (locationsTable == null) { schema = (XmlSchema)schemaLocations[schemaUri]; } else { for (int i = 0; i < locationsTable.Length; i++) { if (schemaUri.Equals(locationsTable[i].Key)) { schema = (XmlSchema)locationsTable[i].Value; break; } } } if (schema != null) { Debug.Assert(ns != null); string tns = schema.TargetNamespace == null ? string.Empty : schema.TargetNamespace; if (tns == ns) { return schema; } else if (tns == string.Empty) { //There could be a chameleon for same ns ChameleonKey cKey = new ChameleonKey(ns, schemaUri); schema = (XmlSchema)chameleonSchemas[cKey]; //Need not clone if a schema for that namespace already exists } else { schema = null; } } return schema; }
internal XmlSchema FindSchemaByNSAndUrl(Uri schemaUri, string ns, DictionaryEntry[] locationsTable) { if ((schemaUri != null) && (schemaUri.OriginalString.Length != 0)) { XmlSchema originalSchema = null; if (locationsTable == null) { originalSchema = (XmlSchema) this.schemaLocations[schemaUri]; } else { for (int i = 0; i < locationsTable.Length; i++) { if (schemaUri.Equals(locationsTable[i].Key)) { originalSchema = (XmlSchema) locationsTable[i].Value; break; } } } if (originalSchema == null) { return originalSchema; } string str = (originalSchema.TargetNamespace == null) ? string.Empty : originalSchema.TargetNamespace; if (str == ns) { return originalSchema; } if (str == string.Empty) { ChameleonKey key = new ChameleonKey(ns, originalSchema); return (XmlSchema) this.chameleonSchemas[key]; } } return null; }