This export script creates a xml file which will be displayed correctly in XML Notepad.
$filename(O:\TEST\Test1.xml,utf-8)'<?xml version="1.0" encoding="utf-8"?>'
'<songs>'
$loop(%_path%)
'<song>'
'<![CDATA[path="'$replace(%_path%,'\','/')'"]]>'
'<![CDATA[title="'%title%'"]]>'
'<![CDATA[artistname="'%artist%'"]]>'
'<![CDATA[time="'%_length%'"]]>'
'<![CDATA[source="'%comment%'"]]>'
'<![CDATA[verbatim="'%album%'"]]>'
'<![CDATA[topic="'%subtitle%'"]]>'
'<![CDATA[notes="'%band%'"]]>'
'</song>'
$loopend()
'</songs>'
If this is not the right way to go ... and you want to escape characters like "<", ">", "&" and so on, then you need somewhat of a html encoding function to encode e. g. "<" to "<".
You can build your own html encoder by using Mp3tag function $replace.
Example:
$replace(%comment%,'<','&_lt;','>','&_gt;','&','&_amp;','[','&_#91;',']','&_#93;','"','&_#34;')
To fake the forum posting renderer I had to use the surrogate character sequence "&_" instead of simple "&", so remove the underline characters from the above code line when using it in reality.
Same for the following export script.
$filename(O:\TEST\Test2.xml,utf-8)'<?xml version="1.0" encoding="utf-8"?>'
'<more_songs>'
$loop(%_path%)
'<song'
'path="'$replace($replace(%_path%,'<','&_lt;','>','&_gt;','&_','&_amp;','[','&_#91;',']','&_#93;','"','&_#34;'),'\','/')'"'
'title="'$replace(%title%,'<','&_lt;','>','&_gt;','&_','&_amp;','[','&_#91;',']','&_#93;','"','&_#34;')'"'
'artistname="'$replace(%artist%,'<','&_lt;','>','&_gt;','&_','&_amp;','[','&_#91;',']','&_#93;','"','&_#34;')'"'
'time="'$replace(%_length%,'<','&_lt;','>','&_gt;','&_','&_amp;','[','&_#91;',']','&_#93;','"','&_#34;')'"'
'source="'$replace(%comment%,'<','&_lt;','>','&_gt;','&_','&_amp;','[','&_#91;',']','&_#93;','"','&_#34;')'"'
'verbatim="'$replace(%album%,'<','&_lt;','>','&_gt;','&_','&_amp;','[','&_#91;',']','&_#93;','"','&_#34;')'"'
'topic="'$replace(%subtitle%,'<','&_lt;','>','&_gt;','&_','&_amp;','[','&_#91;',']','&_#93;','"','&_#34;')'"'
'notes="'$replace(%band%,'<','&_lt;','>','&_gt;','&_','&_amp;','[','&_#91;',']','&_#93;','"','&_#34;')'"'
'/>'
$loopend()
'</more_songs>'
The last export script will give oiutput like the following lines ...
<?xml version="1.0" encoding="utf-8"?>
<more_songs>
<song path="O:/TEST/T1/Divers ~ 00 ~ Genre ~ Electronic - Minimal-Tech House/02.mp3" title="I'm an Old Cowhand from the Rio Grande" artistname="Old Cowhand" time="00:00" source=""For his about-to-be-released autobiography 'My Life'" & "I don't see it as a problem". " verbatim="Rio Grande" topic="" notes="" />
</more_songs>
DD.20100820.1919.CEST