2 // System.Xml.XmlEntity.cs
5 // Duncan Mak (duncan@ximian.com)
6 // Atsushi Enomoto (atsushi@ximian.com)
9 // (C) 2004 Novell Inc.
15 public class XmlEntity : XmlNode
19 internal XmlEntity (string name, string NDATA, string publicId, string systemId,
23 this.name = doc.NameTable.Add (name);
25 this.publicId = publicId;
26 this.systemId = systemId;
27 this.baseUri = doc.BaseURI;
39 XmlLinkedNode lastChild;
45 public override string BaseURI {
46 get { return baseUri; }
49 public override string InnerText {
50 get { return base.InnerText; }
51 set { throw new InvalidOperationException ("This operation is not supported."); }
54 public override string InnerXml {
55 get { return base.InnerXml; }
56 set { throw new InvalidOperationException ("This operation is not supported."); }
59 public override bool IsReadOnly {
60 get { return true; } // always read-only.
63 public override string LocalName {
67 public override string Name {
71 public override XmlNodeType NodeType {
72 get { return XmlNodeType.Entity; }
75 public string NotationName {
84 public override string OuterXml {
85 get { return String.Empty; }
88 public string PublicId {
97 public string SystemId {
109 public override XmlNode CloneNode (bool deep)
111 throw new InvalidOperationException ("This operation is not supported.");
114 public override void WriteContentTo (XmlWriter w)
119 public override void WriteTo (XmlWriter w)
124 internal void SetEntityContent ()
\r
126 if (FirstChild != null)
129 XmlDocumentType doctype = OwnerDocument.DocumentType;
131 if (doctype == null)
\r
134 DTDEntityDeclaration decl = doctype.DTD.EntityDecls [name];
138 XmlNameTable nt = this.OwnerDocument.NameTable;
139 XmlNamespaceManager nsmgr = this.ConstructNamespaceManager ();
140 XmlParserContext ctx = new XmlParserContext (OwnerDocument.NameTable, nsmgr,
141 doctype != null ? doctype.DTD : null,
142 BaseURI, XmlLang, XmlSpace, null);
143 XmlTextReader xmlReader = new XmlTextReader (decl.EntityValue, XmlNodeType.Element, ctx);
144 xmlReader.XmlResolver = OwnerDocument.Resolver;
147 XmlNode n = OwnerDocument.ReadNode (xmlReader);
149 InsertBefore (n, null, false, false);