The Labs \ Source Viewer \ SSCLI \ System.Xml \ XmlComment

  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlComment.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.Xml
  16. {
  17.     using System.Xml.XPath;
  18.     using System.Diagnostics;
  19.    
  20.     // Represents the content of an XML comment.
  21.     public class XmlComment : XmlCharacterData
  22.     {
  23.         protected internal XmlComment(string comment, XmlDocument doc) : base(comment, doc)
  24.         {
  25.         }
  26.        
  27.         // Gets the name of the node.
  28.         public override string Name {
  29.             get { return OwnerDocument.strCommentName; }
  30.         }
  31.        
  32.         // Gets the name of the current node without the namespace prefix.
  33.         public override string LocalName {
  34.             get { return OwnerDocument.strCommentName; }
  35.         }
  36.        
  37.         // Gets the type of the current node.
  38.         public override XmlNodeType NodeType {
  39.             get { return XmlNodeType.Comment; }
  40.         }
  41.        
  42.         // Creates a duplicate of this node.
  43.         public override XmlNode CloneNode(bool deep)
  44.         {
  45.             Debug.Assert(OwnerDocument != null);
  46.             return OwnerDocument.CreateComment(Data);
  47.         }
  48.        
  49.         // Saves the node to the specified XmlWriter.
  50.         public override void WriteTo(XmlWriter w)
  51.         {
  52.             w.WriteComment(Data);
  53.         }
  54.        
  55.         // Saves all the children of the node to the specified XmlWriter.
  56.         public override void WriteContentTo(XmlWriter w)
  57.         {
  58.             // Intentionally do nothing
  59.         }
  60.        
  61.         internal override XPathNodeType XPNodeType {
  62.             get { return XPathNodeType.Comment; }
  63.         }
  64.     }
  65. }

Developer Fusion