How do you specify node result order?

The XPathExpression class provides an AddSort method:

http://msdn.microsoft.com/en-us/library/system.xml.xpath.xpathexpression.aspx


Xpath itself does not define anything for that.

For C#.NET, this may be what you're looking for: http://social.msdn.microsoft.com/forums/en-US/xmlandnetfx/thread/ba975e0e-e0c7-4868-9acc-11d589cafc70/


This can't be accomplished with XPath. If you were using an XPathDocument you could use the AddSort method.

However if you are already using XmlDocument (and/or need to be able to update the XML DOM) its probably just a easy to dump the result of SelectNodes into a SortedDictionary using the value of the Key attribute as the Key value.

Tags:

C#

Sorting

Xpath