Nowadays, XmlDeclaratoin.WriteTo() writes PI instead of raw.
[mono.git] / mcs / class / System.XML / System.Xml / XmlNotation.cs
1 //
2 // System.Xml.XmlNotation.cs
3 //
4 // Author:
5 //      Duncan Mak  (duncan@ximian.com)
6 //
7 // (C) Ximian, Inc.
8 //
9
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System;
32 using System.Xml;
33
34 namespace System.Xml
35 {
36         public class XmlNotation : XmlNode
37         {
38                 #region Fields
39                 
40                 string localName;
41                 string publicId;
42                 string systemId;
43                 string prefix;
44                 
45                 #endregion
46                 
47                 #region Constructor
48                 
49                 internal XmlNotation (string localName, string prefix, string publicId,
50                                       string systemId, XmlDocument doc)
51                         : base (doc)
52                 {
53                         this.localName = doc.NameTable.Add (localName);
54                         this.prefix = doc.NameTable.Add (prefix);
55                         this.publicId = publicId;
56                         this.systemId = systemId;
57                 }
58
59                 #endregion
60
61                 #region Properties
62                 
63                 public override string InnerXml {
64                         get { return String.Empty; }
65                         set { throw new InvalidOperationException ("This operation is not allowed."); }
66                 }
67
68                 public override bool IsReadOnly {
69                         get { return true; } // Notation nodes are always read-only
70                 }
71
72                 public override string LocalName {
73                         get { return localName; }
74                 }
75
76                 public override string Name {
77                         get { return (prefix != String.Empty) ? (prefix + ":" + localName) : localName; }
78                 }
79
80                 public override XmlNodeType NodeType {
81                         get { return XmlNodeType.Notation; }
82                 }
83
84                 public override string OuterXml {
85                         get { return String.Empty; }
86                 }
87
88                 public string PublicId {
89                         get {
90                                 if (publicId != null)
91                                         return publicId;
92                                 else
93                                         return null;
94                         }
95                 }
96
97                 public string SystemId {
98                         get {
99                                 if (systemId != null)
100                                         return systemId;
101                                 else
102                                         return null;
103                         }
104                 }
105
106                 #endregion
107
108                 #region Methods
109                 
110                 public override XmlNode CloneNode (bool deep)
111                 {
112                         throw new InvalidOperationException ("This operation is not allowed.");
113                 }
114
115                 public override void WriteContentTo (XmlWriter w) {     } // has no effect.
116
117                 public override void WriteTo (XmlWriter w) {    } // has no effect.
118                        
119                 #endregion
120         }
121 }