1 //------------------------------------------------------------------------------ 2 // <copyright file="XmlComment.cs" company="Microsoft"> 3 // Copyright (c) Microsoft Corporation. All rights reserved. 4 // </copyright> 5 // <owner current="true" primary="true">Microsoft</owner> 6 //------------------------------------------------------------------------------ 7 8 namespace System.Xml { 9 using System.Xml.XPath; 10 using System.Diagnostics; 11 12 // Represents the content of an XML comment. 13 public class XmlComment: XmlCharacterData { XmlComment( string comment, XmlDocument doc )14 protected internal XmlComment( string comment, XmlDocument doc ): base( comment, doc ) { 15 } 16 17 // Gets the name of the node. 18 public override String Name { 19 get { return OwnerDocument.strCommentName;} 20 } 21 22 // Gets the name of the current node without the namespace prefix. 23 public override String LocalName { 24 get { return OwnerDocument.strCommentName;} 25 } 26 27 // Gets the type of the current node. 28 public override XmlNodeType NodeType { 29 get { return XmlNodeType.Comment;} 30 } 31 32 // Creates a duplicate of this node. CloneNode(bool deep)33 public override XmlNode CloneNode(bool deep) { 34 Debug.Assert( OwnerDocument != null ); 35 return OwnerDocument.CreateComment( Data ); 36 } 37 38 // Saves the node to the specified XmlWriter. WriteTo(XmlWriter w)39 public override void WriteTo(XmlWriter w) { 40 w.WriteComment( Data ); 41 } 42 43 // Saves all the children of the node to the specified XmlWriter. WriteContentTo(XmlWriter w)44 public override void WriteContentTo(XmlWriter w) { 45 // Intentionally do nothing 46 } 47 48 internal override XPathNodeType XPNodeType { get { return XPathNodeType.Comment; } } 49 } 50 } 51 52