/// <summary> /// Gets the namespace prefix that is associated with the /// specified file extension. /// </summary> public static string GetNamespacePrefixForFileName(string filename) { var association = XmlFileAssociationManager.GetAssociationForFileName(filename); if (association != null) { return(association.NamespacePrefix); } return(String.Empty); }
public static XmlSchemaCompletionData GetSchemaCompletionDataForFileName(string filename) { var association = XmlFileAssociationManager.GetAssociationForFileName(filename); if (association == null || association.NamespaceUri.Length == 0) { return(null); } var u = new Uri(association.NamespaceUri); if (u.IsFile) { return(ReadLocalSchema(u)); } else { return(SchemaCompletionDataItems [association.NamespaceUri]); } }
public bool PreferLegacyEditor(FileDescriptor modelDescriptor) { var mimeType = modelDescriptor.MimeType; if (string.IsNullOrEmpty(mimeType)) { mimeType = MimeTypeCatalog.Instance.FindMimeTypeForFile(modelDescriptor.FilePath)?.Id; } if (!string.IsNullOrEmpty(mimeType) && MimeTypeCatalog.Instance.GetMimeTypeIsSubtype( mimeType, MimeTypeCatalog.ApplicationXml)) { return(true); } return(XmlFileAssociationManager.GetAssociationForFileName(modelDescriptor.FilePath) != null); }