mscorlib(4.0.0.0) API with additions
XmlProcessingInstruction.cs
1 using System.Xml.XPath;
2 
3 namespace System.Xml
4 {
7  {
8  private string target;
9 
10  private string data;
11 
14  public override string Name
15  {
16  get
17  {
18  if (target != null)
19  {
20  return target;
21  }
22  return string.Empty;
23  }
24  }
25 
28  public override string LocalName => Name;
29 
33  public override string Value
34  {
35  get
36  {
37  return data;
38  }
39  set
40  {
41  Data = value;
42  }
43  }
44 
47  public string Target => target;
48 
51  public string Data
52  {
53  get
54  {
55  return data;
56  }
57  set
58  {
59  XmlNode parentNode = ParentNode;
60  XmlNodeChangedEventArgs eventArgs = GetEventArgs(this, parentNode, parentNode, data, value, XmlNodeChangedAction.Change);
61  if (eventArgs != null)
62  {
63  BeforeEvent(eventArgs);
64  }
65  data = value;
66  if (eventArgs != null)
67  {
68  AfterEvent(eventArgs);
69  }
70  }
71  }
72 
75  public override string InnerText
76  {
77  get
78  {
79  return data;
80  }
81  set
82  {
83  Data = value;
84  }
85  }
86 
89  public override XmlNodeType NodeType => XmlNodeType.ProcessingInstruction;
90 
91  internal override string XPLocalName => Name;
92 
93  internal override XPathNodeType XPNodeType => XPathNodeType.ProcessingInstruction;
94 
99  protected internal XmlProcessingInstruction(string target, string data, XmlDocument doc)
100  : base(doc)
101  {
102  this.target = target;
103  this.data = data;
104  }
105 
110  public override XmlNode CloneNode(bool deep)
111  {
112  return OwnerDocument.CreateProcessingInstruction(target, data);
113  }
114 
117  public override void WriteTo(XmlWriter w)
118  {
119  w.WriteProcessingInstruction(target, data);
120  }
121 
124  public override void WriteContentTo(XmlWriter w)
125  {
126  }
127  }
128 }
Represents an XML document. You can use this class to load, validate, edit, add, and position XML in ...
Definition: XmlDocument.cs:13
string Data
Gets or sets the content of the processing instruction, excluding the target.
override XmlNodeType NodeType
Gets the type of the current node.
virtual XmlNode ParentNode
Gets the parent of this node (for nodes that can have parents).
Definition: XmlNode.cs:60
internal XmlProcessingInstruction(string target, string data, XmlDocument doc)
Initializes a new instance of the T:System.Xml.XmlProcessingInstruction class.
virtual XmlDocument OwnerDocument
Gets the T:System.Xml.XmlDocument to which this node belongs.
Definition: XmlNode.cs:104
override XmlNode CloneNode(bool deep)
Creates a duplicate of this node.
Definition: __Canon.cs:3
XmlNodeType
Specifies the type of node.
Definition: XmlNodeType.cs:5
Represents a processing instruction, which XML defines to keep processor-specific information in the ...
XPathNodeType
Defines the XPath node types that can be returned from the T:System.Xml.XPath.XPathNavigator class.
Definition: XPathNodeType.cs:4
Represents a writer that provides a fast, non-cached, forward-only way to generate streams or files t...
Definition: XmlWriter.cs:12
Provides data for the E:System.Xml.XmlDocument.NodeChanged, E:System.Xml.XmlDocument....
Gets the node immediately preceding or following this node.
Definition: XmlLinkedNode.cs:4
override string Name
Gets the qualified name of the node.
XmlNodeChangedAction
Specifies the type of node change.
override string Value
Gets or sets the value of the node.
override string LocalName
Gets the local name of the node.
virtual XmlProcessingInstruction CreateProcessingInstruction(string target, string data)
Creates an T:System.Xml.XmlProcessingInstruction with the specified name and data.
Definition: XmlDocument.cs:923
override void WriteTo(XmlWriter w)
Saves the node to the specified T:System.Xml.XmlWriter.
string Target
Gets the target of the processing instruction.
abstract void WriteProcessingInstruction(string name, string text)
When overridden in a derived class, writes out a processing instruction with a space between the name...
override string InnerText
Gets or sets the concatenated values of the node and all its children.
Represents a single node in the XML document.
Definition: XmlNode.cs:13
override void WriteContentTo(XmlWriter w)
Saves all the children of the node to the specified T:System.Xml.XmlWriter. Because ProcessingInstruc...