當前位置: 首頁>>代碼示例>>C#>>正文


C# Xml.XmlComment類代碼示例

本文整理匯總了C#中System.Xml.XmlComment的典型用法代碼示例。如果您正苦於以下問題:C# XmlComment類的具體用法?C# XmlComment怎麽用?C# XmlComment使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XmlComment類屬於System.Xml命名空間,在下文中一共展示了XmlComment類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetUp

		public void SetUp()
		{
			SD.InitializeForUnitTests();
			treeViewContainer = new DerivedXmlTreeViewContainerControl();
			string xml = "<!-- Root comment --><root><!-- Child comment --><child></child></root>";
			treeViewContainer.LoadXml(xml);
			
			doc = treeViewContainer.Document;
			treeView = treeViewContainer.TreeView;
			
			// Get the root comment node in the tree.
			rootCommentNode = (XmlComment)doc.FirstChild;
			rootCommentTreeNode = treeView.Nodes[0] as XmlCommentTreeNode;
			
			// Get the child comment node in the tree.
			rootElementTreeNode = (XmlElementTreeNode)treeView.Nodes[1];
			rootElementTreeNode.Expanding();
			rootElement = rootElementTreeNode.XmlElement;
			
			childCommentTreeNode = rootElementTreeNode.Nodes[0] as XmlCommentTreeNode;
			childCommentNode = (XmlComment)rootElementTreeNode.XmlElement.FirstChild;
			
			childElementTreeNode = rootElementTreeNode.Nodes[1] as XmlElementTreeNode;
			childElement = childElementTreeNode.XmlElement;
		}
開發者ID:Paccc,項目名稱:SharpDevelop,代碼行數:25,代碼來源:EditCommentNodesInTreeControlTestFixture.cs

示例2: SetUp

		public void SetUp()
		{
			XmlCompletionDataProvider completionDataProvider = new XmlCompletionDataProvider(new XmlSchemaCompletionDataCollection(), null, String.Empty);
			treeViewContainerControl = new XmlTreeViewContainerControl();
			treeView = treeViewContainerControl.TreeView;
			treeViewContainerControl.LoadXml(GetXml(), completionDataProvider);
			doc = treeViewContainerControl.Document;
			
			clipboardHandler = treeViewContainerControl as IClipboardHandler;
			
			htmlElement = doc.DocumentElement;
			bodyElement = htmlElement.FirstChild as XmlElement;
			paragraphElement = bodyElement.SelectSingleNode("p") as XmlElement;
			paragraphText = paragraphElement.SelectSingleNode("text()") as XmlText;
			bodyComment = bodyElement.SelectSingleNode("comment()") as XmlComment;
			
			htmlTreeNode = treeView.Nodes[0] as XmlElementTreeNode;
			htmlTreeNode.PerformInitialization();
			bodyTreeNode = htmlTreeNode.FirstNode as XmlElementTreeNode;
			bodyTreeNode.PerformInitialization();
			bodyCommentTreeNode = bodyTreeNode.FirstNode as XmlCommentTreeNode;
			paragraphTreeNode = bodyTreeNode.LastNode as XmlElementTreeNode;
			paragraphTreeNode.PerformInitialization();
			paragraphTextTreeNode = paragraphTreeNode.FirstNode as XmlTextTreeNode;
		}
開發者ID:kingjiang,項目名稱:SharpDevelopLite,代碼行數:25,代碼來源:PasteInTreeControlTestFixture.cs

示例3: XmlCommentName

		public void XmlCommentName ()
		{
			document.LoadXml ("<root><foo></foo></root>");
			comment = document.CreateComment ("Comment");
			AssertEquals (comment.NodeType + " Name property broken",
				comment.Name, "#comment");
		}
開發者ID:jjenki11,項目名稱:blaze-chem-rendering,代碼行數:7,代碼來源:XmlCommentTests.cs

示例4: XmlCommentIsReadOnly

		public void XmlCommentIsReadOnly ()
		{
			document.LoadXml ("<root><foo></foo></root>");
			comment = document.CreateComment ("Comment");
			AssertEquals ("XmlComment IsReadOnly property broken",
				comment.IsReadOnly, false);
		}
開發者ID:jjenki11,項目名稱:blaze-chem-rendering,代碼行數:7,代碼來源:XmlCommentTests.cs

示例5: XmlCommentTreeNode

		public XmlCommentTreeNode(XmlComment comment)
			: base(comment)
		{
			this.comment = comment;
			ImageKey = XmlCommentTreeNodeImageKey;
			SelectedImageKey = ImageKey;
			Update();
		}
開發者ID:kingjiang,項目名稱:SharpDevelopLite,代碼行數:8,代碼來源:XmlCommentTreeNode.cs

示例6: SetUpFixture

		public void SetUpFixture()
		{
			base.InitFixture();
			rootComment = (XmlComment)mockXmlTreeView.Document.FirstChild;
			childElement = (XmlElement)mockXmlTreeView.Document.SelectSingleNode("root/child");
			mockXmlTreeView.SelectedComment = rootComment;
			editor.SelectedNodeChanged();
		}
開發者ID:fanyjie,項目名稱:SharpDevelop,代碼行數:8,代碼來源:EditCommentNodesTestFixture.cs

示例7: Init

		public void Init()
		{
			base.InitFixture();
			rootElement = editor.Document.DocumentElement;
			bodyElement = (XmlElement)rootElement.FirstChild;
			paragraphElement = (XmlElement)bodyElement.SelectSingleNode("p");
			bodyComment = (XmlComment)bodyElement.SelectSingleNode("comment()");
			paragraphText = (XmlText)paragraphElement.SelectSingleNode("text()");
		}
開發者ID:hanjackcyw,項目名稱:SharpDevelop,代碼行數:9,代碼來源:PasteTestFixture.cs

示例8: ExecuteCore

        protected override void ExecuteCore(XmlComment comment)
        {
            if (comment.ParentNode is XmlDocument)
            {
                return;
            }

            Validate();
            var element = comment.OwnerDocument.CreateElement(Name);
            element.InnerText = comment.Value;
            comment.ParentNode.ReplaceChild(element, comment);
        }
開發者ID:rh,項目名稱:mix,代碼行數:12,代碼來源:ConvertToElement.cs

示例9: ExecuteCore

        protected override void ExecuteCore(XmlComment comment)
        {
            Validate();

            var element = comment.ParentNode as XmlElement;

            if (element != null && element.Attributes[Name] == null)
            {
                var attribute = comment.OwnerDocument.CreateAttribute(Name);
                attribute.Value = comment.Value;
                element.Attributes.Append(attribute);
                element.RemoveChild(comment);
            }
        }
開發者ID:rh,項目名稱:mix,代碼行數:14,代碼來源:ConvertToAttribute.cs

示例10: XmlCommentCloneNode

		public void XmlCommentCloneNode ()
		{
			document.LoadXml ("<root><foo></foo></root>");
			comment = document.CreateComment ("Comment");
			original = comment;

			shallow = comment.CloneNode (false); // shallow
			XmlNodeBaseProperties (original, shallow);
			
			deep = comment.CloneNode (true); // deep
			XmlNodeBaseProperties (original, deep);
			Assert.AreEqual (original.Value, deep.Value, "Value incorrectly cloned");

			Assert.AreEqual (deep.OuterXml, shallow.OuterXml, "deep cloning differs from shallow cloning");
		}
開發者ID:nobled,項目名稱:mono,代碼行數:15,代碼來源:XmlCommentTests.cs

示例11: SetUp

		public void SetUp()
		{
			XmlCompletionDataProvider completionDataProvider = new XmlCompletionDataProvider(new XmlSchemaCompletionDataCollection(), null, String.Empty);
			treeViewContainer = new DerivedXmlTreeViewContainerControl();
			treeViewContainer.LoadXml("<!-- Root comment --><root><!-- Child comment --><child></child></root>", completionDataProvider);
			
			doc = treeViewContainer.Document;
			treeView = treeViewContainer.TreeView;
			
			// Get the root comment node in the tree.
			rootCommentNode = (XmlComment)doc.FirstChild;
			rootCommentTreeNode = treeView.Nodes[0] as XmlCommentTreeNode;
			
			// Get the child comment node in the tree.
			rootElementTreeNode = (XmlElementTreeNode)treeView.Nodes[1];
			rootElementTreeNode.Expanding();
			rootElement = rootElementTreeNode.XmlElement;
			
			childCommentTreeNode = rootElementTreeNode.Nodes[0] as XmlCommentTreeNode;
			childCommentNode = (XmlComment)rootElementTreeNode.XmlElement.FirstChild;
			
			childElementTreeNode = rootElementTreeNode.Nodes[1] as XmlElementTreeNode;
			childElement = childElementTreeNode.XmlElement;
		}
開發者ID:kingjiang,項目名稱:SharpDevelopLite,代碼行數:24,代碼來源:EditCommentNodesInTreeControlTestFixture.cs

示例12: SetUp

		public void SetUp()
		{
			treeViewContainerControl = new DerivedXmlTreeViewContainerControl();
			treeView = treeViewContainerControl.TreeView;
			treeViewContainerControl.LoadXml(GetXml());
			doc = treeViewContainerControl.Document;
			
			clipboardHandler = treeViewContainerControl as IClipboardHandler;
			
			htmlElement = doc.DocumentElement;
			bodyElement = htmlElement.FirstChild as XmlElement;
			paragraphElement = bodyElement.SelectSingleNode("p") as XmlElement;
			paragraphText = paragraphElement.SelectSingleNode("text()") as XmlText;
			bodyComment = bodyElement.SelectSingleNode("comment()") as XmlComment;
			
			htmlTreeNode = treeView.Nodes[0] as XmlElementTreeNode;
			htmlTreeNode.PerformInitialization();
			bodyTreeNode = htmlTreeNode.FirstNode as XmlElementTreeNode;
			bodyTreeNode.PerformInitialization();
			bodyCommentTreeNode = bodyTreeNode.FirstNode as XmlCommentTreeNode;
			paragraphTreeNode = bodyTreeNode.LastNode as XmlElementTreeNode;
			paragraphTreeNode.PerformInitialization();
			paragraphTextTreeNode = paragraphTreeNode.FirstNode as XmlTextTreeNode;
		}
開發者ID:hpsa,項目名稱:SharpDevelop,代碼行數:24,代碼來源:PasteInTreeControlTestFixture.cs

示例13: AppendChildComment

		/// <summary>
		/// Appends a new child comment node to the currently selected element.
		/// </summary>
		public void AppendChildComment(XmlComment comment)
		{
			XmlElementTreeNode selectedNode = SelectedElementNode;
			if (selectedNode != null) {
				XmlCommentTreeNode newNode = new XmlCommentTreeNode(comment);
				newNode.AddTo(selectedNode);
				selectedNode.Expand();
			}
		}
開發者ID:kingjiang,項目名稱:SharpDevelopLite,代碼行數:12,代碼來源:XmlTreeViewControl.cs

示例14: RemoveComment

		/// <summary>
		/// Removes the specified comment from the tree.
		/// </summary>
		public void RemoveComment(XmlComment comment)
		{
			XmlCommentTreeNode node = FindComment(comment);
			if (node != null) {
				node.Remove();
			}
		}
開發者ID:kingjiang,項目名稱:SharpDevelopLite,代碼行數:10,代碼來源:XmlTreeViewControl.cs

示例15: AddXmlComment

 private void AddXmlComment(StringBuilder sb, int indentationLevel, XmlComment xmlComment)
 {
     Indent(sb, indentationLevel);
     sb.Append(string.Format(@"\cf{0}<!--{1}-->\par", (int)ColorKinds.Comment, XmlEncode(xmlComment.Value)));
 }
開發者ID:Green-Bug,項目名稱:nunit-gui,代碼行數:5,代碼來源:Xml2RtfConverter.cs


注:本文中的System.Xml.XmlComment類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。