[Mono-bugs] [Bug 63574][Maj] New - XmlNode.InnerText does not replace the innerText in all cases

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 20 Aug 2004 20:29:14 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by andreas.hausladen@gmx.de.

http://bugzilla.ximian.com/show_bug.cgi?id=63574

--- shadow/63574	2004-08-20 20:29:14.000000000 -0400
+++ shadow/63574.tmp.3518	2004-08-20 20:29:14.000000000 -0400
@@ -0,0 +1,53 @@
+Bug#: 63574
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Sys.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: Andreas.Hausladen@gmx.de               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlNode.InnerText does not replace the innerText in all cases
+
+When you set the InnerText of an XmlNode to a string and the XmlNode 
+(XmlElement) has child nodes the resulting InnerText is a conjuction of 
+the old InnerText and the new InnerText. Means the child nodes are not 
+deleted. This is a difference to MS.NET. 
+ 
+Steps to reproduce the problem: 
+1. Load a Xml file with "<node>Text<child>Text</child></node>" 
+2. Set the InnerText to a string value 
+3. Read the same innerText and output it to the console. 
+ 
+<type>QPair&lt;QString,int&gr;:: 
+  <ref refid="classQPair">QPair</ref> 
+  &lt; 
+  <ref refid="classQString">QString</ref> 
+  ,int&gt; 
+</type> 
+ 
+//typeNode.InnerXml = ""; // this fixes the bug 
+typeNode.InnerText = "QPair<QString, int>"; 
+Console.WriteLine(typeNode.InnerText); 
+ 
+Actual Results: 
+QPair<QString, int>QPair<QString,int>QPair<QString,int>" 
+ 
+Expected Results: 
+QPair<QString, int> 
+ 
+ 
+How often does this happen?  
+Every time. 
+ 
+ 
+Additional Information: 
+ 
+Set InnerXml = "" before you set InnerText = "Str" fixes the bug.