Example #1
0
 /// <summary>
 /// Attempts to locate the type name in the specified schema.
 /// </summary>
 /// <param name="name">The type to look up.</param>
 /// <param name="schemaCompletionData">The schema completion data to use to
 /// find the type.</param>
 /// <param name="elementName">The element to determine what sort of type it is
 /// (e.g. group, attribute, element).</param>
 /// <returns><see langword="null"/> if no match can be found.</returns>
 static XmlSchemaObject FindSchemaObjectType(string name, XmlCompletionDataProvider provider, XmlSchemaCompletionData schemaCompletionData, string elementName)
 {
     QualifiedName qualifiedName = schemaCompletionData.CreateQualifiedName(name);
     XmlSchemaCompletionData qualifiedNameSchema = provider.FindSchema(qualifiedName.Namespace);
     if (qualifiedNameSchema != null) {
         schemaCompletionData = qualifiedNameSchema;
     }
     switch (elementName) {
         case "element":
             return schemaCompletionData.FindComplexType(qualifiedName);
         case "attribute":
             return schemaCompletionData.FindSimpleType(qualifiedName.Name);
     }
     return null;
 }