I built my own solution and want to share it to others as nobody was able to provide one.
1. I have to parse the XML by each 'row' element to get the child nodes:
Dim lst As List(Of String) = Nothing
For Each c As XmlNode In n.ChildNodes
Dim l As New List(Of String)
For Each ch As XmlNode In c.ChildNodes
If ch.NodeType = XmlNodeType.Element Then l.Add(ch.Name)
Next
Merge(lst, l)
Next
For Each s As String In lst
Debug.Print(s)
Next
2. The method 'Merge' does the job - it checks if each element of 2nd list is already in 1st list; if not: it tries to find one of the next values of 2nd list in 1st list; of an existing value could be found, it inserts the value of 2nd list at index of 1st otherwise it adds it to end of 1st list:
Sub Merge(ByRef a As List(Of String), b As List(Of String))
If a Is Nothing OrElse a.Count = 0 Then a = b
For i As Integer = 0 To b.Count - 1
If Not a.Contains(b(i)) Then
Dim index As Integer = -1
For j As Integer = i + 1 To b.Count - 1
If a.Contains(b(j)) Then
index = a.IndexOf(b(j))
Exit For
End If
Next
If Not index = -1 Then
a.Insert(index, b(i))
Else
a.Add(b(i))
End If
Else
End If
Next
End Sub
The result is the expected list in correct order:
line1
line2
line3
line4