Another way : #Include <Array.au3> $txt = FileRead("file.xml") $tmp = StringRegExp($txt, '(?i)(?:<(Category)>|\G)(?|<(Category(?:Parent)?(?:ID|Name))>([^<]+))<\/(?-1)', 3) _ArrayDisplay($tmp) $n = 0 For $i = 0 To UBound($tmp) - 1 Step 3 If $tmp[$i] = "Category" Then $n += 1 ConsoleWrite(@CRLF & "Item #" & $n & @CRLF) EndIf ConsoleWrite(" " & $tmp[$i + 1] & " : " & $tmp[$i + 2]