Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Junk characters illegal for XML
Message
De
08/04/2014 13:06:56
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
08/04/2014 11:36:04
Denis Filer
University of Oxford
Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01598264
Message ID:
01598285
Vues:
61
J'aime (1)
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 && include those to transform like <>&
lcYourData = from_somewhere
lcYourData = CHRTRAN(lcYourData,CHRTRAN(lcYourData,lcXMLChars,''),'') && this will remove all but lcXMLChars
lcYourData = STRTRAN(.....) && translate special chars
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.

Off

There is no place like [::1]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform