/// <summary>
        /// Gets the namespace prefix that is associated with the
        /// specified file extension.
        /// </summary>
        public static string GetNamespacePrefix(string extension)
        {
            string prefix = String.Empty;

            XmlSchemaAssociation association = XmlEditorAddInOptions.GetSchemaAssociation(extension);

            if (association != null)
            {
                prefix = association.NamespacePrefix;
            }

            return(prefix);
        }
        /// <summary>
        /// Gets the schema completion data that is associated with the
        /// specified file extension.
        /// </summary>
        public static XmlSchemaCompletionData GetSchemaCompletionData(string extension)
        {
            XmlSchemaCompletionData data = null;

            XmlSchemaAssociation association = XmlEditorAddInOptions.GetSchemaAssociation(extension);

            if (association != null)
            {
                if (association.NamespaceUri.Length > 0)
                {
                    data = SchemaCompletionDataItems[association.NamespaceUri];
                }
            }
            return(data);
        }
Example #3
0
        /// <summary>
        /// Reads the configured xml file extensions and their associated namespaces.
        /// </summary>
        void PopulateFileExtensionComboBox()
        {
            string [] extensions = XmlView.GetXmlFileExtensions();

            foreach (string extension in extensions)
            {
                XmlSchemaAssociation            association = XmlEditorAddInOptions.GetSchemaAssociation(extension);
                XmlSchemaAssociationListBoxItem item        = new XmlSchemaAssociationListBoxItem(association.Extension, association.NamespaceUri, association.NamespacePrefix);
                fileExtensionComboBox.Items.Add(item);
            }

            if (fileExtensionComboBox.Items.Count > 0)
            {
                fileExtensionComboBox.SelectedIndex = 0;
                FileExtensionComboBoxSelectedIndexChanged(this, new EventArgs());
            }
        }