* Implemented ReadInnerXml and ReadOuterXml. We still need to validate for
[mono.git] / mcs / class / System.XML / System.Xml / XmlNode.cs
index 55ff9c940ce2fa74037073d31aacce15574f0a0a..87fbc8aa2141ed642b2509944ac385a8a9fa5a73 100644 (file)
@@ -25,7 +25,7 @@ namespace System.Xml
 
                #region Constructors
 
-               protected internal XmlNode (XmlDocument ownerDocument)
+               internal XmlNode (XmlDocument ownerDocument)
                {
                        this.ownerDocument = ownerDocument;
                }
@@ -143,7 +143,6 @@ namespace System.Xml
 
                public abstract XmlNodeType NodeType { get;     }
 
-               [MonoTODO]
                public virtual string OuterXml {
                        get {
                                StringWriter sw = new StringWriter ();
@@ -173,10 +172,9 @@ namespace System.Xml
                        get { return null; }
                }
 
-               [MonoTODO]
                public virtual string Value {
-                       get { throw new NotImplementedException (); }
-                       set { throw new NotImplementedException (); }
+                       get { return null; }
+                       set { throw new InvalidOperationException ("This node does not have a value"); }
                }
 
                #endregion
@@ -185,9 +183,13 @@ namespace System.Xml
 
                public virtual XmlNode AppendChild (XmlNode newChild)
                {
-                       if (NodeType == XmlNodeType.Document || NodeType == XmlNodeType.Element || NodeType == XmlNodeType.Attribute) {
-                               XmlLinkedNode newLinkedChild = (XmlLinkedNode)newChild;
+                       if (NodeType == XmlNodeType.Document
+                           || NodeType == XmlNodeType.Element
+                           || NodeType == XmlNodeType.Attribute) {
+                               XmlLinkedNode newLinkedChild = (XmlLinkedNode) newChild;
                                XmlLinkedNode lastLinkedChild = LastLinkedChild;
+
+                               newLinkedChild.parentNode = this;
                                
                                if (lastLinkedChild != null) {
                                        newLinkedChild.NextLinkedSibling = lastLinkedChild.NextLinkedSibling;
@@ -308,25 +310,25 @@ namespace System.Xml
                }
 
                [MonoTODO]
-               public virtual XmlNodeList SelectNodes (string xpath)
+               public XmlNodeList SelectNodes (string xpath)
                {
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
-               public virtual XmlNodeList SelectNodes (string xpath, XmlNamespaceManager nsmgr)
+               public XmlNodeList SelectNodes (string xpath, XmlNamespaceManager nsmgr)
                {
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
-               public virtual XmlNode SelectSingleNode (string xpath)
+               public XmlNode SelectSingleNode (string xpath)
                {
                        throw new NotImplementedException ();
                }
 
                [MonoTODO]
-               public virtual XmlNode SelectSingleNode (string xpath, XmlNamespaceManager nsmgr)
+               public XmlNode SelectSingleNode (string xpath, XmlNamespaceManager nsmgr)
                {
                        throw new NotImplementedException ();
                }