示例#1
0
        /// <summary>
        /// Gets the possible root elements for an xml document using this schema.
        /// </summary>
        public ICompletionData[] GetElementCompletionData(string namespacePrefix)
        {
            XmlCompletionDataCollection data = new XmlCompletionDataCollection();

            foreach (XmlSchemaElement element in schema.Elements.Values)
            {
                if (element.Name != null)
                {
                    AddElement(data, element.Name, namespacePrefix, element.Annotation);
                }
                else
                {
                    // Do not add reference element.
                }
            }

            return data.ToArray();
        }
示例#2
0
        /// <summary>
        /// Gets the autocomplete data for the specified attribute value.
        /// </summary>
        public ICompletionData[] GetAttributeValueCompletionData(XmlElementPath path, string name)
        {
            XmlCompletionDataCollection data = new XmlCompletionDataCollection();

            // Locate matching element.
            XmlSchemaElement element = FindElement(path);

            // Get completion data.
            if (element != null)
            {
                data = GetAttributeValueCompletionData(element, name);
            }

            return data.ToArray();
        }
示例#3
0
        /// <summary>
        /// Gets the child element completion data for the xml element that exists
        /// at the end of the specified path.
        /// </summary>
        public ICompletionData[] GetChildElementCompletionData(XmlElementPath path)
        {
            XmlCompletionDataCollection data = new XmlCompletionDataCollection();

            // Locate matching element.
            XmlSchemaElement element = FindElement(path);

            // Get completion data.
            if (element != null)
            {
                data = GetChildElementCompletionData(element, path.Elements.LastPrefix);
            }

            return data.ToArray();
        }
示例#4
0
        /// <summary>
        /// Gets the attribute completion data for the xml element that exists
        /// at the end of the specified path.
        /// </summary>
        public ICompletionData[] GetAttributeCompletionData(XmlElementPath path)
        {
            XmlCompletionDataCollection data = new XmlCompletionDataCollection();

            // Locate matching element.
            XmlSchemaElement element = FindElement(path);

            // Get completion data.
            if (element != null)
            {
                prohibitedAttributes.Clear();
                data = GetAttributeCompletionData(element);
            }

            return data.ToArray();
        }