2002-08-25 Tim Coleman <tim@timcoleman.com>
[mono.git] / mcs / class / System.XML / System.Xml / XmlProcessingInstruction.cs
1 //
2 // System.Xml.XmlProcessingInstruction
3 //
4 // Author:
5 //   Kral Ferch <kral_ferch@hotmail.com>
6 //
7 // (C) 2002 Kral Ferch
8 //
9
10 using System;
11
12 namespace System.Xml
13 {
14         public class XmlProcessingInstruction : XmlLinkedNode
15         {
16                 string target;
17                 string data;
18
19                 #region Constructors
20
21                 protected internal XmlProcessingInstruction (string target, string data, XmlDocument doc) : base(doc)
22                 {
23                         if (data == null)
24                                 data = String.Empty;
25
26                         this.target = target;
27                         this.data = data;
28                 }
29
30                 #endregion
31
32                 #region Properties
33
34                 public string Data
35                 {
36                         get { return data; }
37
38                         set { data = value; }
39                 }
40
41                 public override string InnerText
42                 {
43                         get { return Data; }
44                         set { data = value; }
45                 }
46
47                 public override string LocalName
48                 {
49                         get { return target; }
50                 }
51
52                 public override string Name
53                 {
54                         get { return target; }
55                 }
56
57                 public override XmlNodeType NodeType
58                 {
59                         get { return XmlNodeType.ProcessingInstruction; }
60                 }
61                 
62                 public string Target
63                 {
64                         get { return target; }
65                 }
66
67                 public override string Value
68                 {
69                         get { return data; }
70                         set {
71                                 if (this.IsReadOnly)
72                                         throw new ArgumentException ("This node is read-only.");
73                                 else
74                                         data = value;
75                         }
76                 }
77
78                 #endregion
79
80                 #region Methods
81
82                 public override XmlNode CloneNode (bool deep)
83                 {
84                         return new XmlProcessingInstruction (target, data, OwnerDocument);
85                 }
86
87                 public override void WriteContentTo (XmlWriter w) { }
88
89                 public override void WriteTo (XmlWriter w)
90                 {
91                         w.WriteProcessingInstruction (target, data);
92                 }
93
94                 #endregion
95         }
96 }