An alternative approach for anyone interested in RegEx. It is probably an over-kill for smaller data sets but could well be worth it for larger ones (seconds instead of minutes in terms of runtime). It is based on the info provided in the post so would possibly have to be adjusted if the actual file differs (I assumed the 5 tag items keep repeating).
Code: Select all
//Read the XML data into the variable strXML
LabelToVar>XML,strXML,1,0,{"*/"}
//Remove any lines without tags, ie only keep lines with tags
RegEx>(?m)^[^<]*\n,strXML,0,M,NM,1,,strXML
//From the remaining lines, remove all tags, ie gives you the items line by line
RegEx></?.+?>,strXML,0,M,NM,1,,strXML
//Put everything on one line with items comma separated by replacing each carriage return/line feed with comma
RegEx>\r\n,strXML,0,M,NM,1,{","},strXML
//If all the records are the same size (here 5) then the following can be used to
//put one record per line by adding a carriage return/line feed after each group
//Just remove if not applicable
CodeBlock
Let>RecordSize=5
Let>tmp0=((.*?,){%RecordSize%})
RegEx>tmp0,strXML,0,M,NM,1,$1%CRLF%,strXML
EndCodeBlock
//Remove the trailing comma on each line
Let>tmp0=(?m),$
RegEx>tmp0,strXML,0,M,NM,1,,strXML
MDL>strXML
/*
XML:
<name>John1</name>
<surname>Jerremy</surname>
<age>15</age>
<weight>63</weight>
<height>165</height>
Garbage
Garbage
<name>John2</name>
<surname>Jerremy</surname>
<age>15</age>
<weight>63</weight>
<height>165</height>
Garbage
Garbage
<name>John3</name>
<surname>Jerremy</surname>
<age></age>
<weight></weight>
<height>165</height>
*/