[Mono-bugs] [Bug 456103] XmlNodeList from SelectNodes has a count of 1 but null item.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Dec 9 02:49:50 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=456103

User atsushi at ximian.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=456103#c2





--- Comment #2 from Atsushi Enomoto <atsushi at ximian.com>  2008-12-09 00:49:49 MST ---
Simplified:

using System;
using System.Xml;

namespace Matmlbug
{
        class Program
        {
                static void Main (string[] args)
                {
                        XmlDocument doc = new XmlDocument ();
                        doc.LoadXml ("<root><X/></root>");

                        XmlElement el = doc.DocumentElement;
                        string concat = "descendant::X";
                        XmlNodeList nl = el.SelectNodes (concat);

                        Console.WriteLine ("nl.Count = {0}", nl.Count);
                        XmlNode n = nl [0];
                        Console.WriteLine (n != null ? n.Name : "(bug)");
                }
        }
}

Replacing "descendant::X" with ".//X" workarounds the issue.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list