dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]System.Xml bug? Itterating through ChildNodes...


From: minddog
Subject: Re: [DotGNU]System.Xml bug? Itterating through ChildNodes...
Date: Tue, 25 Feb 2003 12:12:14 -0700

I see a problem in this chunk of System.Xml/NodeList.cs
It seems to pass off the first node because it's refNode is null and it has
a parent
so it goes to the else {}.  I'm trying to figure out a way to catch it, but
I'm just not creative this week =/  Any hands?

        public void InsertAfter(XmlNode newNode, XmlNode refNode)
                        {
                                if(refNode != null)
                                {
                                        NodeList refList = GetList(refNode);
                                        NodeList newList = GetList(newNode);
                                        if(refList.nextSibling != null)
                                        {
                                                newList.nextSibling =
refList.ne
xtSibling;
                                                newList.prevSibling =
refNode;
                                                refList.nextSibling =
newNode;
                                        }
                                        else
                                        {
                                                refList.nextSibling =
newNode;
                                                newList.prevSibling =
refNode;
                                                last = newNode;
                                        }
                                }
                                else if(first != null)
                                {
                                        GetList(first).prevSibling =
newNode;
                                        GetList(newNode).nextSibling =
first;
                                }
                                else
                                {
                                        first = newNode;
                                        last = newNode;
                                }
                                ++count;
                                ++generation;
                        }
----- Original Message -----
From: "Chris Smith" <address@hidden>
To: "minddog" <address@hidden>
Cc: "DotGNU Mailing List" <address@hidden>
Sent: Friday, February 21, 2003 3:05 PM
Subject: [DotGNU]System.Xml bug? Itterating through ChildNodes...


Chaps,
Done a bit of poking about but not got to the bottom if this yet.

Itterating through node.ChildNode's seems to skip the first child node, even
though .ChildNode.Count returns the true count.

Attached is a test prog and some sample XML.

See yah.
Chris



reply via email to

[Prev in Thread] Current Thread [Next in Thread]