number one: VFP CHRTRAN (this ends up the same as Brandons, but with less lines)
note that VFP9 allows 0hHH hex chars so you can go around endless chr()
lcXMLChars = '_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'+lcwathever +0h090A0D
lcYourData = from_somewhere
lcYourData = CHRTRAN(lcYourData,CHRTRAN(lcYourData,lcXMLChars,''),'')
lcYourData = STRTRAN(.....)
number two:
use regular expressions. This can do the same.
Beg your pardon, but I have no time now to show you how. It's a bit tricky but nice. I know it can be done but it I have no solution at hand. :(
Possibly create a thread to Gregory Adam, he is expert in this.
HTH
Lutz
>Removal would be perfect...
>
>>Do you like to remove or replace?
>>
>>>Does anyone know a good way to remove illegal characters (i.e. disliked by XML) from text strings being exported to XML files. Some of our old databases, even some new, have erroneous characters (special symbols, right angles, odd smiley faces, and the like) which throw XML. We check of course for for XML tags < and >, & and also I pass strings through a whole series of STRTRAN() commands trying to trap and remove these - but all to often, another weird character crops up and throws the XML file. We are not using CDATA. Any hints here greatly appreciated. Denis
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]