2002-03-28 Duncan Mak <duncan@ximian.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                         this.target = target;
24                         this.data = data;
25                 }
26
27                 #endregion
28
29                 #region Properties
30
31                 public string Data
32                 {
33                         get { return data; }
34
35                         set { data = value; }
36                 }
37
38                 public override string InnerText
39                 {
40                         get { return Data; }
41                         set { data = value; }
42                 }
43
44                 public override string LocalName
45                 {
46                         get { return target; }
47                 }
48
49                 public override string Name
50                 {
51                         get { return target; }
52                 }
53
54                 public override XmlNodeType NodeType
55                 {
56                         get { return XmlNodeType.ProcessingInstruction; }
57                 }
58                 
59                 public string Target
60                 {
61                         get { return target; }
62                 }
63
64                 public override string Value
65                 {
66                         get { return data; }
67                         set {
68                                 if (this.IsReadOnly)
69                                         throw new ArgumentException ("This node is read-only.");
70                                 else
71                                         data = value;
72                         }
73                 }
74
75                 #endregion
76
77                 #region Methods
78
79                 public override XmlNode CloneNode (bool deep)
80                 {
81                         return new XmlProcessingInstruction (target, data, OwnerDocument);
82                 }
83
84                 public override void WriteContentTo (XmlWriter w) { }
85
86                 public override void WriteTo (XmlWriter w)
87                 {
88                         w.WriteProcessingInstruction (target, data);
89                 }
90
91                 #endregion
92         }
93 }