[Mono-list] some System.XML bugfixes

David Sheldon dave-monolist@earth.li
Mon, 2 Dec 2002 23:28:39 +0000

On Sun, Dec 01, 2002 at 02:37:50AM +0900, ginga(A.E.) wrote:
> I fixed some problems reported by David, Sebastien and ville.
> Thanks.

I think I might have fixed the 
  TestInsertAfter(MonoTests.System.Xml.XmlNodeTests) "#InsertAfter.BadPositionButNoError.1"

When InsertAfter remaps the call into an InsertBefore(xxx, null), to
insert it at the end, then InsertBefore skips the checking if it is
being inserted around a DocumentElement. Surely (non-whitespace)
Elements/Characters/EntityReferences cannot occur anywhere outside the
DocumentElement so I have removed this test. 

I have also put in a comment regarding inserting whitespace nodes.
Whitespace outside the DocumentElement is ignored in DOM, but I am
unsure of its status in the CLR library. I believe that you should be
able to insert whitespace nodes here to assist in layout before
serialising despite the fact that they are insignificant in the current
represenations. What do you think about this?


RCS file: /mono/mcs/class/System.XML/System.Xml/XmlNode.cs,v
retrieving revision 1.41
diff -u -r1.41 XmlNode.cs
--- System.Xml/XmlNode.cs       2 Dec 2002 17:57:45 -0000       1.41
+++ System.Xml/XmlNode.cs       2 Dec 2002 23:08:45 -0000
@@ -366,7 +366,9 @@
                                if (refChild != null && newChild.OwnerDocument != refChild.OwnerDocument)
                                                throw new ArgumentException ("argument nodes are on the different documents.");

-                               if (refChild != null && this == ownerDoc &&
+                               // FIXME CharacterData and EntityReferences are allowed if they 
+                               // refer to whitespace see http://www.w3.org/TR/REC-xml#NT-Misc
+                               if (this == ownerDoc &&
                                    ownerDoc.DocumentElement != null &&
                                    (newChild is XmlElement ||
                                     newChild is XmlCharacterData ||

Calm down, it's *only* ones and zeroes.