**** Merged from MCS ****
[mono-project.git] / mcs / class / System.XML / System.Xml / XmlNotation.cs
blob3275377737669227b59f055f35d1c54a7c140a15
1 //
2 // System.Xml.XmlNotation.cs
3 //
4 // Author:
5 // Duncan Mak (duncan@ximian.com)
6 //
7 // (C) Ximian, Inc.
8 //
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.
31 using System;
32 using System.Xml;
34 namespace System.Xml
36 public class XmlNotation : XmlNode
38 #region Fields
40 string localName;
41 string publicId;
42 string systemId;
43 string prefix;
45 #endregion
47 #region Constructor
49 internal XmlNotation (string localName, string prefix, string publicId,
50 string systemId, XmlDocument doc)
51 : base (doc)
53 this.localName = doc.NameTable.Add (localName);
54 this.prefix = doc.NameTable.Add (prefix);
55 this.publicId = publicId;
56 this.systemId = systemId;
59 #endregion
61 #region Properties
63 public override string InnerXml {
64 get { return String.Empty; }
65 set { throw new InvalidOperationException ("This operation is not allowed."); }
68 public override bool IsReadOnly {
69 get { return true; } // Notation nodes are always read-only
72 public override string LocalName {
73 get { return localName; }
76 public override string Name {
77 get { return (prefix != String.Empty) ? (prefix + ":" + localName) : localName; }
80 public override XmlNodeType NodeType {
81 get { return XmlNodeType.Notation; }
84 public override string OuterXml {
85 get { return String.Empty; }
88 public string PublicId {
89 get {
90 if (publicId != null)
91 return publicId;
92 else
93 return null;
97 public string SystemId {
98 get {
99 if (systemId != null)
100 return systemId;
101 else
102 return null;
106 #endregion
108 #region Methods
110 public override XmlNode CloneNode (bool deep)
112 throw new InvalidOperationException ("This operation is not allowed.");
115 public override void WriteContentTo (XmlWriter w) { } // has no effect.
117 public override void WriteTo (XmlWriter w) { } // has no effect.
119 #endregion