mscorlib(4.0.0.0) API with additions
XmlEntity.cs
1 namespace System.Xml
2 {
4  public class XmlEntity : XmlNode
5  {
6  private string publicId;
7 
8  private string systemId;
9 
10  private string notationName;
11 
12  private string name;
13 
14  private string unparsedReplacementStr;
15 
16  private string baseURI;
17 
18  private XmlLinkedNode lastChild;
19 
20  private bool childrenFoliating;
21 
25  public override bool IsReadOnly => true;
26 
29  public override string Name => name;
30 
33  public override string LocalName => name;
34 
38  public override string InnerText
39  {
40  get
41  {
42  return base.InnerText;
43  }
44  set
45  {
46  throw new InvalidOperationException(Res.GetString("Xdom_Ent_Innertext"));
47  }
48  }
49 
50  internal override bool IsContainer => true;
51 
52  internal override XmlLinkedNode LastNode
53  {
54  get
55  {
56  if (lastChild == null && !childrenFoliating)
57  {
58  childrenFoliating = true;
59  XmlLoader xmlLoader = new XmlLoader();
60  xmlLoader.ExpandEntity(this);
61  }
62  return lastChild;
63  }
64  set
65  {
66  lastChild = value;
67  }
68  }
69 
72  public override XmlNodeType NodeType => XmlNodeType.Entity;
73 
76  public string PublicId => publicId;
77 
80  public string SystemId => systemId;
81 
84  public string NotationName => notationName;
85 
88  public override string OuterXml => string.Empty;
89 
93  public override string InnerXml
94  {
95  get
96  {
97  return string.Empty;
98  }
99  set
100  {
101  throw new InvalidOperationException(Res.GetString("Xdom_Set_InnerXml"));
102  }
103  }
104 
107  public override string BaseURI => baseURI;
108 
109  internal XmlEntity(string name, string strdata, string publicId, string systemId, string notationName, XmlDocument doc)
110  : base(doc)
111  {
112  this.name = doc.NameTable.Add(name);
113  this.publicId = publicId;
114  this.systemId = systemId;
115  this.notationName = notationName;
116  unparsedReplacementStr = strdata;
117  childrenFoliating = false;
118  }
119 
125  public override XmlNode CloneNode(bool deep)
126  {
127  throw new InvalidOperationException(Res.GetString("Xdom_Node_Cloning"));
128  }
129 
130  internal override bool IsValidChildType(XmlNodeType type)
131  {
132  if (type != XmlNodeType.Text && type != XmlNodeType.Element && type != XmlNodeType.ProcessingInstruction && type != XmlNodeType.Comment && type != XmlNodeType.CDATA && type != XmlNodeType.Whitespace && type != XmlNodeType.SignificantWhitespace)
133  {
134  return type == XmlNodeType.EntityReference;
135  }
136  return true;
137  }
138 
141  public override void WriteTo(XmlWriter w)
142  {
143  }
144 
147  public override void WriteContentTo(XmlWriter w)
148  {
149  }
150 
151  internal void SetBaseURI(string inBaseURI)
152  {
153  baseURI = inBaseURI;
154  }
155  }
156 }
Represents an XML document. You can use this class to load, validate, edit, add, and position XML in ...
Definition: XmlDocument.cs:13
XmlNameTable NameTable
Gets the T:System.Xml.XmlNameTable associated with this implementation.
Definition: XmlDocument.cs:230
override void WriteTo(XmlWriter w)
Saves the node to the specified T:System.Xml.XmlWriter. For XmlEntity nodes, this method has no effec...
Definition: XmlEntity.cs:141
override void WriteContentTo(XmlWriter w)
Saves all the children of the node to the specified T:System.Xml.XmlWriter. For XmlEntity nodes,...
Definition: XmlEntity.cs:147
override string OuterXml
Gets the markup representing this node and all its children.
Definition: XmlEntity.cs:88
override string LocalName
Gets the name of the node without the namespace prefix.
Definition: XmlEntity.cs:33
override XmlNode CloneNode(bool deep)
Creates a duplicate of this node. Entity nodes cannot be cloned. Calling this method on an T:System....
Definition: XmlEntity.cs:125
XmlNodeType
Specifies the type of node.
Definition: XmlNodeType.cs:5
override bool IsReadOnly
Gets a value indicating whether the node is read-only.
Definition: XmlEntity.cs:25
string PublicId
Gets the value of the public identifier on the entity declaration.
Definition: XmlEntity.cs:76
Represents a writer that provides a fast, non-cached, forward-only way to generate streams or files t...
Definition: XmlWriter.cs:12
override XmlNodeType NodeType
Gets the type of the node.
Definition: XmlEntity.cs:72
string NotationName
Gets the name of the optional NDATA attribute on the entity declaration.
Definition: XmlEntity.cs:84
Represents an entity declaration, such as <!ENTITY... >.
Definition: XmlEntity.cs:4
override string InnerText
Gets the concatenated values of the entity node and all its children.
Definition: XmlEntity.cs:39
Gets the node immediately preceding or following this node.
Definition: XmlLinkedNode.cs:4
abstract string Add(char[] array, int offset, int length)
When overridden in a derived class, atomizes the specified string and adds it to the XmlNameTable.
override string InnerXml
Gets the markup representing the children of this node.
Definition: XmlEntity.cs:94
override string BaseURI
Gets the base Uniform Resource Identifier (URI) of the current node.
Definition: XmlEntity.cs:107
override string Name
Gets the name of the node.
Definition: XmlEntity.cs:29
The exception that is thrown when a method call is invalid for the object's current state.
Represents a single node in the XML document.
Definition: XmlNode.cs:13
string SystemId
Gets the value of the system identifier on the entity declaration.
Definition: XmlEntity.cs:80