1 //------------------------------------------------------------------------------
2 // <copyright file="XmlProcessingInstruction.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 // <owner current="true" primary="true">Microsoft</owner>
6 //------------------------------------------------------------------------------
11 using System.Diagnostics;
13 using System.Xml.XPath;
15 // Represents a processing instruction, which XML defines to keep
16 // processor-specific information in the text of the document.
17 public class XmlProcessingInstruction : XmlLinkedNode {
21 protected internal XmlProcessingInstruction( string target, string data, XmlDocument doc ) : base( doc ) {
26 // Gets the name of the node.
27 public override String Name {
35 // Gets the name of the current node without the namespace prefix.
36 public override string LocalName {
40 // Gets or sets the value of the node.
41 public override String Value {
43 set { Data = value; } //use Data instead of data so that event will be fired
46 // Gets the target of the processing instruction.
47 public String Target {
51 // Gets or sets the content of processing instruction,
52 // excluding the target.
56 XmlNode parent = ParentNode;
57 XmlNodeChangedEventArgs args = GetEventArgs( this, parent, parent, data, value, XmlNodeChangedAction.Change );
66 // Gets or sets the concatenated values of the node and
68 public override string InnerText {
70 set { Data = value; } //use Data instead of data so that change event will be fired
73 // Gets the type of the current node.
74 public override XmlNodeType NodeType {
75 get { return XmlNodeType.ProcessingInstruction;}
78 // Creates a duplicate of this node.
79 public override XmlNode CloneNode(bool deep) {
80 Debug.Assert( OwnerDocument != null );
81 return OwnerDocument.CreateProcessingInstruction( target, data );
84 // Saves the node to the specified XmlWriter.
85 public override void WriteTo(XmlWriter w) {
86 w.WriteProcessingInstruction(target, data);
89 // Saves all the children of the node to the specified XmlWriter.
90 public override void WriteContentTo(XmlWriter w) {
91 // Intentionally do nothing
94 internal override string XPLocalName { get { return Name; } }
95 internal override XPathNodeType XPNodeType { get { return XPathNodeType.ProcessingInstruction; } }