• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# XmlCompletionItemCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中XmlCompletionItemCollection的典型用法代码示例。如果您正苦于以下问题:C# XmlCompletionItemCollection类的具体用法?C# XmlCompletionItemCollection怎么用?C# XmlCompletionItemCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XmlCompletionItemCollection类属于命名空间,在下文中一共展示了XmlCompletionItemCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SetCompletionWindowWidth

		void SetCompletionWindowWidth(ICompletionListWindow completionWindow, XmlCompletionItemCollection completionItems)
		{
			XmlCompletionItem firstListItem = completionItems[0];
			if (firstListItem.DataType == XmlCompletionItemType.NamespaceUri) {
				completionWindow.Width = double.NaN;
			}
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:7,代码来源:XmlCodeCompletionBinding.cs


示例2: LinkElementHasAddressAndXlinkHrefAttribute

		public void LinkElementHasAddressAndXlinkHrefAttribute()
		{
			XmlCompletionItemCollection expectedAttributes = new XmlCompletionItemCollection();
			expectedAttributes.Add(new XmlCompletionItem("address", XmlCompletionItemType.XmlAttribute));
			expectedAttributes.Add(new XmlCompletionItem("xlink:href", XmlCompletionItemType.XmlAttribute));
			
			Assert.AreEqual(expectedAttributes.ToArray(), linkElementAttributes.ToArray());
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:8,代码来源:SimpleContentExtensionBaseTypeWithAttributeTestFixture.cs


示例3: ListCompleteMethodCallsCompletionItemCompleteMethod

        public void ListCompleteMethodCallsCompletionItemCompleteMethod()
        {
            CompletionContext context = new CompletionContext();
            XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
            completionItems.Complete(context, this);

            Assert.AreSame(contextPassedToCompleteMethod, context);
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:8,代码来源:CompleteCompletionItemListTestFixture.cs


示例4: CanGetCompletionItemsUsedAsShowCompletionMethodParameters

		public void CanGetCompletionItemsUsedAsShowCompletionMethodParameters()
		{
			XmlCompletionItemCollection list = new XmlCompletionItemCollection();
			list.Add(new XmlCompletionItem("a"));
			editor.ShowCompletionWindow(list);

			Assert.AreSame(list, editor.CompletionItemsDisplayed);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:8,代码来源:MockTextEditorTests.cs


示例5: CanCheckCompletionWindowFromShowCompletionHasWidthPropertyModified

		public void CanCheckCompletionWindowFromShowCompletionHasWidthPropertyModified()
		{
			XmlCompletionItemCollection list = new XmlCompletionItemCollection();
			list.Add(new XmlCompletionItem("a"));
			ICompletionListWindow window = editor.ShowCompletionWindow(list);
			window.Width = double.NaN;
			
			Assert.AreEqual(double.NaN, editor.CompletionWindowDisplayed.Width);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:9,代码来源:MockTextEditorTests.cs


示例6: Init

		public void Init()
		{
			firstItem = new XmlCompletionItem("text", "desc-1", XmlCompletionItemType.XmlElement);
			secondItem = new XmlCompletionItem("text2", "desc-2", XmlCompletionItemType.XmlAttribute);
			
			itemCollection = new XmlCompletionItemCollection();
			itemCollection.Add(firstItem);
			itemCollection.Add(secondItem);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:9,代码来源:XmlCompletionItemCollectionTests.cs


示例7: ExpectedCompletionDataItems

		public void ExpectedCompletionDataItems()
		{
			XmlCompletionItemCollection expectedItems = new XmlCompletionItemCollection();
			expectedItems.Add(new XmlCompletionItem("a", XmlCompletionItemType.NamespaceUri));
			expectedItems.Add(new XmlCompletionItem("b", XmlCompletionItemType.NamespaceUri));
			expectedItems.Add(new XmlCompletionItem("c", XmlCompletionItemType.NamespaceUri));
			
			Assert.AreEqual(expectedItems.ToArray(), textEditor.CompletionItemsDisplayedToArray());
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:9,代码来源:NamespaceCompletionWindowTestFixture.cs


示例8: CanConvertCompletionItemsUsedAsShowCompletionMethodParametersToArray

		public void CanConvertCompletionItemsUsedAsShowCompletionMethodParametersToArray()
		{
			XmlCompletionItem item = new XmlCompletionItem("a");
			List<XmlCompletionItem> expectedArray = new List<XmlCompletionItem>();
			expectedArray.Add(item);
			
			XmlCompletionItemCollection list = new XmlCompletionItemCollection();
			list.Add(item);
			editor.ShowCompletionWindow(list);

			Assert.AreEqual(expectedArray.ToArray(), editor.CompletionItemsDisplayedToArray());
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:12,代码来源:MockTextEditorTests.cs


示例9: GetAttributeCompletionReturnsAttributesFromDuplicateFooSchema

        public void GetAttributeCompletionReturnsAttributesFromDuplicateFooSchema()
        {
            string xml =
                "<duplicate-foo-note xmlns='foo'>\r\n" +
                "        <duplicate-foo-text ";

            XmlCompletionItemCollection items = schemas.GetAttributeCompletion(xml, null);

            XmlCompletionItemCollection expectedItems = new XmlCompletionItemCollection();
            expectedItems.Add(new XmlCompletionItem("duplicate-foo-text-attribute", XmlCompletionItemType.XmlAttribute));

            Assert.AreEqual(expectedItems, items);
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:13,代码来源:DuplicateSchemaNamespaceAddedToCollectionTestFixture.cs


示例10: Init

        public void Init()
        {
            XmlCompletionItem lastItem = new XmlCompletionItem("cc", XmlCompletionItemType.XmlElement);
            XmlCompletionItem secondItem = new XmlCompletionItem("bb", XmlCompletionItemType.XmlElement);
            XmlCompletionItem firstItem = new XmlCompletionItem("aa", XmlCompletionItemType.XmlElement);

            XmlCompletionItemCollection collection = new XmlCompletionItemCollection();
            collection.Add(lastItem);
            collection.Add(secondItem);
            collection.Add(firstItem);

            expectedCompletionItems = new XmlCompletionItem[] { firstItem, secondItem, lastItem };

            completionItems = new XmlCompletionItemCollection(collection);
            completionItems.Sort();
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:16,代码来源:SortingXmlCompletionItemsTestFixture.cs


示例11: GetCompletionItems

		XmlCompletionItemCollection GetCompletionItems(ITextEditor editor, XmlSchemaCompletion defaultSchema)
		{
			int offset = editor.Caret.Offset;
			string textUpToCursor = editor.Document.GetText(0, offset);
			
			XmlCompletionItemCollection items = new XmlCompletionItemCollection();
			if (XmlParser.IsInsideAttributeValue(textUpToCursor, offset)) {
				items = schemas.GetNamespaceCompletion(textUpToCursor);
				if (items.Count == 0)
					items = schemas.GetAttributeValueCompletion(textUpToCursor, editor.Caret.Offset, defaultSchema);
			} else {
				items = schemas.GetAttributeCompletion(textUpToCursor, defaultSchema);
				if (items.Count == 0)
					items = schemas.GetElementCompletion(textUpToCursor, defaultSchema);
			}
			return items;
		}
开发者ID:rbrunhuber,项目名称:SharpDevelop,代码行数:17,代码来源:XmlCodeCompletionBinding.cs


示例12: GetAttributeValueCompletionReturnsValuesForDuplicateFooSchema

        public void GetAttributeValueCompletionReturnsValuesForDuplicateFooSchema()
        {
            string xml =
                "<duplicate-foo-note xmlns='foo'>\r\n" +
                "    <duplicate-foo-text duplicate-foo-text-attribute='f'";

            string xmlUpToCursor = xml.Substring(0, xml.Length - 1);

            XmlCompletionItemCollection items = schemas.GetAttributeValueCompletion('f', xmlUpToCursor, null);
            items.Sort();

            XmlCompletionItemCollection expectedItems = new XmlCompletionItemCollection();
            expectedItems.Add(new XmlCompletionItem("first", XmlCompletionItemType.XmlAttributeValue));
            expectedItems.Add(new XmlCompletionItem("fourth", XmlCompletionItemType.XmlAttributeValue));
            expectedItems.Add(new XmlCompletionItem("second", XmlCompletionItemType.XmlAttributeValue));
            expectedItems.Add(new XmlCompletionItem("third", XmlCompletionItemType.XmlAttributeValue));

            Assert.AreEqual(expectedItems, items);
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:19,代码来源:DuplicateSchemaNamespaceAddedToCollectionTestFixture.cs


示例13: GetAttributeValueCompletion

		XmlCompletionItemCollection GetAttributeValueCompletion(XmlSchemaAttribute attribute)
		{
			XmlCompletionItemCollection completionItems = new XmlCompletionItemCollection();
			
			if (attribute.SchemaType != null) {
				XmlSchemaSimpleTypeRestriction simpleTypeRestriction = attribute.SchemaType.Content as XmlSchemaSimpleTypeRestriction;
				if (simpleTypeRestriction != null) {
					completionItems.AddRange(GetAttributeValueCompletion(simpleTypeRestriction));
				}
			} else if (attribute.AttributeSchemaType != null) {
				XmlSchemaSimpleType simpleType = attribute.AttributeSchemaType as XmlSchemaSimpleType;
				
				if (simpleType != null) {
					if (simpleType.Datatype.TypeCode == XmlTypeCode.Boolean) {
						completionItems.AddRange(GetBooleanAttributeValueCompletion());
					} else {
						completionItems.AddRange(GetAttributeValueCompletion(simpleType));
					}
				}
			}
			
			return completionItems;
		}
开发者ID:Netring,项目名称:SharpDevelop,代码行数:23,代码来源:XmlSchemaCompletion.cs


示例14: AddAttribute

		/// <summary>
		/// Adds an attribute to the completion data collection.
		/// </summary>
		/// <remarks>
		/// Note the special handling of xml:lang attributes.
		/// </remarks>
		void AddAttribute(XmlCompletionItemCollection completionItems, XmlSchemaAttribute attribute, XmlNamespaceCollection namespacesInScope)
		{
			string name = attribute.Name;
			if (name == null) {
				if (attribute.RefName.Namespace == "http://www.w3.org/XML/1998/namespace") {
					name = String.Concat("xml:", attribute.RefName.Name);
				} else {
					string prefix = namespacesInScope.GetPrefix(attribute.RefName.Namespace);
					if (!String.IsNullOrEmpty(prefix)) {
						name = String.Concat(prefix, ":", attribute.RefName.Name);
					}
				}
			}
			
			if (name != null) {
				string documentation = GetDocumentation(attribute.Annotation);
				XmlCompletionItem item = new XmlCompletionItem(name, documentation, XmlCompletionItemType.XmlAttribute);
				completionItems.Add(item);
			}
		}
开发者ID:Netring,项目名称:SharpDevelop,代码行数:26,代码来源:XmlSchemaCompletion.cs


示例15: FixtureInit

		public override void FixtureInit()
		{
			XmlElementPath path = new XmlElementPath();
			path.AddElement(new QualifiedName("schema", "http://www.w3.org/2001/XMLSchema"));
			
			schemaChildElements = SchemaCompletion.GetChildElementCompletion(path);
			schemaAttributes = SchemaCompletion.GetAttributeCompletion(path);
			
			// Get include elements attributes.
			path.AddElement(new QualifiedName("include", "http://www.w3.org/2001/XMLSchema"));
			includeAttributes = SchemaCompletion.GetAttributeCompletion(path);
		
			// Get annotation element info.
			path.Elements.RemoveLast();
			path.AddElement(new QualifiedName("annotation", "http://www.w3.org/2001/XMLSchema"));
			
			annotationChildElements = SchemaCompletion.GetChildElementCompletion(path);
			annotationAttributes = SchemaCompletion.GetAttributeCompletion(path);
		
			// Get app info attributes.
			path.AddElement(new QualifiedName("appinfo", "http://www.w3.org/2001/XMLSchema"));
			appInfoAttributes = SchemaCompletion.GetAttributeCompletion(path);
			
			// Get foo attributes.
			path = new XmlElementPath();
			path.AddElement(new QualifiedName("foo", "http://www.w3.org/2001/XMLSchema"));
			fooAttributes = SchemaCompletion.GetAttributeCompletion(path);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:28,代码来源:ExtensionElementTestFixture.cs


示例16: FixtureInit

        public override void FixtureInit()
        {
            XmlElementPath path = new XmlElementPath();
            path.AddElement(new QualifiedName("foo", "http://foo.com"));

            fooChildElementCompletion = SchemaCompletion.GetChildElementCompletion(path);
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:ElementRefAnnotationTestFixture.cs


示例17: FixtureInit

        public override void FixtureInit()
        {
            XmlElementPath path = new XmlElementPath();
            path.AddElement(new QualifiedName("note", "http://www.w3schools.com"));

            noteChildElements = SchemaCompletion.GetChildElementCompletion(path);
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:ChoiceTestFixture.cs


示例18: FixtureInit

		public override void FixtureInit()
		{
			XmlElementPath path = new XmlElementPath();
			path.AddElement(new QualifiedName("root", "http://foo"));
			path.AddElement(new QualifiedName("bar", "http://foo"));
			barElementAttributes = SchemaCompletion.GetAttributeCompletion(path);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:MissingSchemaElementTestFixture.cs


示例19: FixtureInit

		public override void FixtureInit()
		{
			XmlElementPath path = new XmlElementPath();
			path.AddElement(new QualifiedName("foo", "http://foo.com"));
			
			attributeCompletionItems = SchemaCompletion.GetAttributeCompletion(path);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:7,代码来源:SimpleContentWithAttributeTestFixture.cs


示例20: FixtureInit

        public override void FixtureInit()
        {
            XmlElementPath path = new XmlElementPath();
            path.AddElement(new QualifiedName("html", "http://foo/xhtml"));

            htmlChildElements = SchemaCompletion.GetChildElementCompletion(path);
        }
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:7,代码来源:DuplicateElementTestFixture.cs



注:本文中的XmlCompletionItemCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# XmlData类代码示例发布时间:2022-05-24
下一篇:
C# Xml类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap