/// <summary> /// Attempts to locate the reference name in the specified schema. /// </summary> /// <param name="name">The reference to look up.</param> /// <param name="schemaCompletionData">The schema completion data to use to /// find the reference.</param> /// <param name="elementName">The element to determine what sort of reference it is /// (e.g. group, attribute, element).</param> /// <returns><see langword="null"/> if no match can be found.</returns> XmlSchemaObject FindSchemaObjectReference(string name, XmlSchemaCompletionData schemaCompletionData, string elementName) { QualifiedName qualifiedName = schemaCompletionData.CreateQualifiedName(name); XmlSchemaCompletionData qualifiedNameSchema = FindSchema(qualifiedName.Namespace); if (qualifiedNameSchema != null) { schemaCompletionData = qualifiedNameSchema; } switch (elementName) { case "element": return schemaCompletionData.FindElement(qualifiedName); case "attribute": return schemaCompletionData.FindAttribute(qualifiedName.Name); case "group": return schemaCompletionData.FindGroup(qualifiedName.Name); case "attributeGroup": return schemaCompletionData.FindAttributeGroup(qualifiedName.Name); } return null; }