public void FooSchemaElementAndBarElementInXml() { string xml = "<foo-note xmlns='foo' xmlns:b='bar'>\r\n" + " <b:bar-note>\r\n" + " <"; XmlCompletionItemCollection expectedItems = new XmlCompletionItemCollection(); expectedItems.Add(new XmlCompletionItem("b:bar-text", XmlCompletionItemType.XmlElement)); expectedItems.Add(new XmlCompletionItem("foo-text", XmlCompletionItemType.XmlElement)); XmlCompletionItemCollection items = schemas.GetElementCompletion(xml, null); items.Sort(); Assert.AreEqual(expectedItems, items); }
protected XmlCompletionItemCollection GetCompletionItemsForAttribute(XmlSchemaCompletion defaultSchema, XmlSchemaCompletionCollection schemas) { int offset = this.Position.Offset; string textUpToCursor = this.Text.GetText(0, offset); XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection(); completionItems = schemas.GetAttributeCompletion(textUpToCursor, defaultSchema); if (completionItems.Count == 0) { completionItems = schemas.GetElementCompletion(textUpToCursor, defaultSchema); if (this.HasOpenToken == false) { completionItems.Select(i => { i.Text = "<" + i.Text; return(i); }).ToList(); } completionItems.Add(new XmlCompletionItem("<?")); completionItems.Add(new XmlCompletionItem("<!--")); } return(completionItems); }