I am modifying my XML using LINQ:
Dim feedXML As XDocument = XDocument.Parse(m_xmld.OuterXml.ToString()) Dim SortedFields = From field In feedXML.Descendants('fields') Dim sFieldList = From field In SortedFields.Descendants('field') Order By Integer.Parse(field.@position)
I am trying to sort my ‘fields’ in ascending order. Now my problem is I want the sorted fields to replace my unsorted fields list in the XML so that I can use the sorted XML further.
How can I retrieve the XML after the sorting?
There’s no real concept of ‘the XML after the sorting’. If you’ve only got field elements, it’s relatively easy – but if you’ve got:
then what should the result be afterwards?