From e09e9032252b2a5d0fcf0df7c97744f3df8e3bdc Mon Sep 17 00:00:00 2001 From: Ravi Pratap M Date: Mon, 26 Aug 2002 20:26:15 +0000 Subject: 2002-08-26 Ravi Pratap * XmlAttribute.cs (InnerText): Implement getting this property. * XmlNode.cs (InnerText): Ensure that we append only values of text nodes. svn path=/trunk/mcs/; revision=7061 --- mcs/class/System.XML/System.Xml/ChangeLog | 8 ++++++++ mcs/class/System.XML/System.Xml/XmlAttribute.cs | 20 +++++++++++++++++--- mcs/class/System.XML/System.Xml/XmlNode.cs | 5 +++-- 3 files changed, 28 insertions(+), 5 deletions(-) (limited to 'mcs/class/System.XML/System.Xml') diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog index 2dbe7e6c862..3aa3b3a2686 100644 --- a/mcs/class/System.XML/System.Xml/ChangeLog +++ b/mcs/class/System.XML/System.Xml/ChangeLog @@ -1,3 +1,11 @@ +2002-08-26 Ravi Pratap + + + * XmlAttribute.cs (InnerText): Implement getting this property. + + * XmlNode.cs (InnerText): Ensure that we append only values of + text nodes. + 2002-08-26 Gonzalo Paniagua Javier * XmlWriter.cs: made ws and namespaceManager protected. mcs has a bug diff --git a/mcs/class/System.XML/System.Xml/XmlAttribute.cs b/mcs/class/System.XML/System.Xml/XmlAttribute.cs index 70419b6c593..56e8658f4d5 100644 --- a/mcs/class/System.XML/System.Xml/XmlAttribute.cs +++ b/mcs/class/System.XML/System.Xml/XmlAttribute.cs @@ -8,6 +8,7 @@ // using System; +using System.Text; namespace System.Xml { @@ -46,17 +47,30 @@ namespace System.Xml } } - [MonoTODO] + [MonoTODO ("Setter")] public override string InnerText { get { - throw new NotImplementedException (); - } + StringBuilder builder = new StringBuilder (); + AppendChildValues (this, builder); + return builder.ToString (); + } set { throw new NotImplementedException (); } } + private void AppendChildValues (XmlNode parent, StringBuilder builder) + { + XmlNode node = parent.FirstChild; + + while (node != null) { + builder.Append (node.Value); + AppendChildValues (node, builder); + node = node.NextSibling; + } + } + [MonoTODO ("Setter.")] public override string InnerXml { get { diff --git a/mcs/class/System.XML/System.Xml/XmlNode.cs b/mcs/class/System.XML/System.Xml/XmlNode.cs index 4df1845b3a5..d4d39a77aef 100644 --- a/mcs/class/System.XML/System.Xml/XmlNode.cs +++ b/mcs/class/System.XML/System.Xml/XmlNode.cs @@ -77,12 +77,13 @@ namespace System.Xml set { throw new NotImplementedException (); } } - private void AppendChildValues(XmlNode parent, StringBuilder builder) + private void AppendChildValues (XmlNode parent, StringBuilder builder) { XmlNode node = parent.FirstChild; while (node != null) { - builder.Append (node.Value); + if (node.NodeType == XmlNodeType.Text) + builder.Append (node.Value); AppendChildValues (node, builder); node = node.NextSibling; } -- cgit v1.2.3