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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlNotation.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;
  18.     using System.Diagnostics;
  19.    
  20.     // Contains a notation declared in the DTD or schema.
  21.     public class XmlNotation : XmlNode
  22.     {
  23.         string publicId;
  24.         string systemId;
  25.         string name;
  26.        
  27.         internal XmlNotation(string name, string publicId, string systemId, XmlDocument doc) : base(doc)
  28.         {
  29.             this.name = doc.NameTable.Add(name);
  30.             this.publicId = publicId;
  31.             this.systemId = systemId;
  32.         }
  33.        
  34.         // Gets the name of the node.
  35.         public override string Name {
  36.             get { return name; }
  37.         }
  38.        
  39.         // Gets the name of the current node without the namespace prefix.
  40.         public override string LocalName {
  41.             get { return name; }
  42.         }
  43.        
  44.         // Gets the type of the current node.
  45.         public override XmlNodeType NodeType {
  46.             get { return XmlNodeType.Notation; }
  47.         }
  48.        
  49.         // Throws an InvalidOperationException since Notation can not be cloned.
  50.         public override XmlNode CloneNode(bool deep)
  51.         {
  52.            
  53.             throw new InvalidOperationException(Res.GetString(Res.Xdom_Node_Cloning));
  54.         }
  55.        
  56.         //
  57.         // Microsoft extensions
  58.         //
  59.        
  60.         // Gets a value indicating whether the node is read-only.
  61.         public override bool IsReadOnly {
  62.                 // Make notations readonly
  63.             get { return true; }
  64.         }
  65.        
  66.         // Gets the value of the public identifier on the notation declaration.
  67.         public string PublicId {
  68.             get { return publicId; }
  69.         }
  70.        
  71.         // Gets the value of
  72.         // the system identifier on the notation declaration.
  73.         public string SystemId {
  74.             get { return systemId; }
  75.         }
  76.        
  77.         // Without override these two functions, we can't guarantee that WriteTo()/WriteContent() functions will never be called
  78.         public override string OuterXml {
  79.             get { return String.Empty; }
  80.         }
  81.        
  82.         public override string InnerXml {
  83.             get { return String.Empty; }
  84.             set {
  85.                 throw new InvalidOperationException(Res.GetString(Res.Xdom_Set_InnerXml));
  86.             }
  87.         }
  88.        
  89.         // Saves the node to the specified XmlWriter.
  90.         public override void WriteTo(XmlWriter w)
  91.         {
  92.         }
  93.        
  94.         // Saves all the children of the node to the specified XmlWriter.
  95.         public override void WriteContentTo(XmlWriter w)
  96.         {
  97.         }
  98.     }
  99. }

Developer Fusion