mscorlib(4.0.0.0) API with additions
XmlWhitespace.cs
1 using System.Xml.XPath;
2 
3 namespace System.Xml
4 {
7  {
10  public override string Name => OwnerDocument.strNonSignificantWhitespaceName;
11 
14  public override string LocalName => OwnerDocument.strNonSignificantWhitespaceName;
15 
18  public override XmlNodeType NodeType => XmlNodeType.Whitespace;
19 
22  public override XmlNode ParentNode
23  {
24  get
25  {
26  switch (base.parentNode.NodeType)
27  {
28  case XmlNodeType.Document:
29  return base.ParentNode;
30  case XmlNodeType.Text:
31  case XmlNodeType.CDATA:
32  case XmlNodeType.Whitespace:
33  case XmlNodeType.SignificantWhitespace:
34  {
35  XmlNode parentNode = base.parentNode.parentNode;
36  while (parentNode.IsText)
37  {
38  parentNode = parentNode.parentNode;
39  }
40  return parentNode;
41  }
42  default:
43  return base.parentNode;
44  }
45  }
46  }
47 
51  public override string Value
52  {
53  get
54  {
55  return Data;
56  }
57  set
58  {
59  if (CheckOnData(value))
60  {
61  Data = value;
62  return;
63  }
64  throw new ArgumentException(Res.GetString("Xdom_WS_Char"));
65  }
66  }
67 
68  internal override XPathNodeType XPNodeType
69  {
70  get
71  {
72  XPathNodeType xnt = XPathNodeType.Whitespace;
73  DecideXPNodeTypeForTextNodes(this, ref xnt);
74  return xnt;
75  }
76  }
77 
78  internal override bool IsText => true;
79 
82  public override XmlNode PreviousText
83  {
84  get
85  {
86  if (parentNode.IsText)
87  {
88  return parentNode;
89  }
90  return null;
91  }
92  }
93 
97  protected internal XmlWhitespace(string strData, XmlDocument doc)
98  : base(strData, doc)
99  {
100  if (!doc.IsLoading && !CheckOnData(strData))
101  {
102  throw new ArgumentException(Res.GetString("Xdom_WS_Char"));
103  }
104  }
105 
110  public override XmlNode CloneNode(bool deep)
111  {
113  }
114 
117  public override void WriteTo(XmlWriter w)
118  {
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
override XmlNodeType NodeType
Gets the type of the node.
override string Name
Gets the qualified name of the node.
override XmlNode PreviousText
Gets the text node that immediately precedes this node.
virtual XmlDocument OwnerDocument
Gets the T:System.Xml.XmlDocument to which this node belongs.
Definition: XmlNode.cs:104
Represents white space in element content.
Definition: XmlWhitespace.cs:6
internal XmlWhitespace(string strData, XmlDocument doc)
Initializes a new instance of the T:System.Xml.XmlWhitespace class.
override XmlNode CloneNode(bool deep)
Creates a duplicate of this node.
Definition: __Canon.cs:3
abstract void WriteWhitespace(string ws)
When overridden in a derived class, writes out the given white space.
XmlNodeType
Specifies the type of node.
Definition: XmlNodeType.cs:5
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
virtual XmlWhitespace CreateWhitespace(string text)
Creates an T:System.Xml.XmlWhitespace node.
virtual string Data
Contains the data of the node.
override string Value
Gets or sets the value of the node.
override XmlNode ParentNode
Gets the parent of the current node.
The exception that is thrown when one of the arguments provided to a method is not valid.
override string LocalName
Gets the local name of the node.
Provides text manipulation methods that are used by several classes.
override void WriteTo(XmlWriter w)
Saves the node to the specified T:System.Xml.XmlWriter.
override XmlNode ParentNode
Gets the parent node of this node (for nodes that can have parents).
Definition: XmlDocument.cs:123
override void WriteContentTo(XmlWriter w)
Saves all the children of the node to the specified T:System.Xml.XmlWriter.
Represents a single node in the XML document.
Definition: XmlNode.cs:13