/// <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(); }
/// <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(); }
/// <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(); }
/// <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(); }
/// <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,string[] toExclude) { XmlCompletionDataCollection data = new XmlCompletionDataCollection(); // Locate matching element. XmlSchemaElement element = FindElement(path); // Get completion data. if (element != null) { prohibitedAttributes.Clear(); data = GetAttributeCompletionData(element); } var lookable = data.ToArray(); foreach (string exclude in toExclude) { var res = lookable.Where(q => q.Text == exclude).FirstOrDefault(); if (null != res) data.Remove(res as XmlCompletionData); } return data.ToArray(); }