我有一个 XML 文档,我想按字母顺序对特定节点进行排序。
XML 文档
<response>
<lst name="facet_counts">
<lst name="facet_fields">
<lst name="professions_raw_nl">
<int name="Pharmacy">2724</int>
<int name="Physiotherapy">2474</int>
<int name="Doctor">2246</int>
<int name="Dentist">1309</int>
</lst>
</lst>
</lst>
</response>
期望输出
牙医 (1309)
医生 (2246)
药房 (2724)
物理治疗 (2474)
当前的 ASP.NET 代码
dim node as XmlNode = objXML.SelectSingleNode("response/lst[@name=""facet_counts""]/lst[@name=""facet_fields""]/lst[@name=""professions_raw_nl""]")
Dim sbuilder As New StringBuilder
Dim navigator As XPathNavigator = node.CreateNavigator()
Dim selectExpression As XPathExpression = navigator.Compile("???") <-- what expression should I use here ???
selectExpression.AddSort("????", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Text) <-- what expression should I use here ????
Dim nodeIterator As XPathNodeIterator = navigator.Select(selectExpression)
While nodeIterator.MoveNext()
'how can I print the name and value of the node?
End While