Merge pull request #228 from QuickJack/3e163743eda89cc8c239779a75dd245be12aee3c
[mono.git] / mcs / class / System.XML / System.Xml / XmlEntity.cs
old mode 100755 (executable)
new mode 100644 (file)
index a1dd3f0..9366805
@@ -33,7 +33,7 @@ using Mono.Xml;
 
 namespace System.Xml
 {
-       public class XmlEntity : XmlNode
+       public class XmlEntity : XmlNode, IHasXmlChildNode
        {
                #region Constructors
 
@@ -57,11 +57,26 @@ namespace System.Xml
                string publicId;
                string systemId;
                string baseUri;
+               XmlLinkedNode lastLinkedChild;
+               bool contentAlreadySet;
 
                #endregion
 
                #region Properties
 
+               XmlLinkedNode IHasXmlChildNode.LastLinkedChild {
+                       get {
+                               if (lastLinkedChild != null)
+                                       return lastLinkedChild;
+                               if (!contentAlreadySet) {
+                                       contentAlreadySet = true;
+                                       SetEntityContent ();
+                               }
+                               return lastLinkedChild;
+                       }
+                       set { lastLinkedChild = value; }
+               }
+
                public override string BaseURI {
                        get {  return baseUri; }
                }
@@ -131,9 +146,9 @@ namespace System.Xml
                        // No effect.
                }
 
-               internal void SetEntityContent ()
+               void SetEntityContent ()
                {
-                       if (FirstChild != null)
+                       if (lastLinkedChild != null)
                                return;
 
                        XmlDocumentType doctype = OwnerDocument.DocumentType;