Classifique os nós XML em ordem alfabética no nome do atributo
Eu tenho um documento XML para o qual eu quero classificar nós específicos em ordem alfabética.
Documento 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>
Saída desejada
Dentista (1309)
Doutor (2246)
Farmácia (2724)
Fisioterapia (2474)
Código ASP.NET atual
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