I found the bug; although it is a bit strange. In .NET, there's a method of the XmlNode class called SelectSingleNode(). This method has two overloads. I use SelectSingleNode(string xpath) which allows me to pick any node that meets the xpath criteria. I assumed SelectSingleNode selected a child node in the given XmlNode (it only makes sense). Instead, it was selecting the first node in the document that met the criteria. In this case, it is the first news article in the document. I can understand XmlDocument.DocumentElement.SelectSingleNode() selecting the first occuring node in the document, but I just don't understand XmlNode.SelectSingleNode() selecting any node other than its children. Perhaps it's a bug in .NET. I ought to report it.
2/25/2004 12:00:00 AM | Tags: