RosettaCodeData/Task/XML-Output/Vedit-macro-language/xml-output.vedit

19 lines
503 B
Plaintext

// Replace special characters with entities:
Replace("&", "&", BEGIN+ALL+NOERR) // this must be the first replace!
Replace("<", "&lt;", BEGIN+ALL+NOERR)
Replace(">", "&gt;", BEGIN+ALL+NOERR)
Replace("'", "&apos;", BEGIN+ALL+NOERR)
Replace('"', "&quot;", BEGIN+ALL+NOERR)
// Insert XML marking
BOF
IT("<CharacterRemarks>") IN
Repeat(ALL) {
Search("^.", REGEXP+ERRBREAK)
IT(' <Character name="')
Replace('|T', '">')
EOL IT('</Character>')
}
EOF
IT("</CharacterRemarks>") IN