Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to deal with ampersend sign?
Message
De
02/01/2008 14:24:12
 
 
Information générale
Forum:
ASP.NET
Catégorie:
XML
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01278970
Message ID:
01279059
Vues:
24
You're welcome. Let us know when you have it working! :o)


>Thank you, again.
>
>>I can't seem to post it though without it getting parsed here on the UT as well, should be:
>>
>>
>>   lcReturn = ALLTRIM(lcReturn)
>>   lcReturn = STRTRAN(lcReturn, '&', '&')
>>   lcReturn = STRTRAN(lcReturn, '<', '&& # 108 ; t ;') && remove spaces
>>   lcReturn = STRTRAN(lcReturn, '>', '>')
>>   lcReturn = STRTRAN(lcReturn, '"', '"')
>>   lcReturn = STRTRAN(lcReturn, "'", ''')
>>
>>
>>>Very helpful. Thank you very much.
>>>
>>>>Well, thanks to Rick Strahl and Mike Helland, maybe this will help you:
>>>>
>>>>
>>>>*-----------------------------------------------------------------------
>>>>FUNCTION XmlEncode
>>>>LPARAMETERS teExpression
>>>>
>>>>*-- Transfrom 5 Known reserved XML characters Courtesy of Rick Strahl
>>>>*-- and Mike Helland
>>>>LOCAL lcReturn
>>>>lcReturn = TRAN(teExpression)
>>>>
>>>>IF VARTYPE(teExpression) = 'C'
>>>>   lcReturn = ALLTRIM(lcReturn)
>>>>   lcReturn = STRTRAN(lcReturn, '&', '&')
>>>>   lcReturn = STRTRAN(lcReturn, '<', '<')
>>>>   lcReturn = STRTRAN(lcReturn, '>', '>')
>>>>   lcReturn = STRTRAN(lcReturn, '"', '"')
>>>>   lcReturn = STRTRAN(lcReturn, "'", ''')
>>>>ENDIF
>>>>
>>>>RETURN lcReturn
>>>>
>>>>*-------------------------------------------------------------------------
>>>>FUNCTION XMLDeCode
>>>>LPARAMETERS cTXT
>>>>
>>>>*-- Transfrom 5 Known reserved XML characters Courtesy of Rick Strahl
>>>>*-- and Mike Helland
>>>>
>>>>LOCAL i,ch
>>>>FOR i=1 TO 255
>>>>  ch=ALLTRIM(STR(i))
>>>>  cTXT=STRTRAN(cTXT,"&#"+ch+";",CHR(i))
>>>>ENDFOR
>>>>RETURN cTXT
>>>>
>>>>
>>>>>None of the below. Very kludgy code that uses DO WHILE, SUBSTR, etc.
>>>>>
>>>>>>Using xmltocursor, xmladapter, or what?
>>>>>>
>>>>>>
>>>>>>>You are absolutely correct. My VFP Stored procedure parses the XML string sent by the ASP.NET. What I was saying that so far, I was simply parsing the XML string and setting the values of the XML elements to the columns of VFP tables. The problem was that elements of XML file (string) had the "&" + "amp" + ";" (of course, if your of ASP.NET entered ampersand sign). So now I will have to "clean" up the string from the XML file (as I parse it) of this "undesirable" characters.
>>>>>>>
>>>>>>>>Your stored procedure should parse the file. Can you post your stored procedure? The data should not be stored in xml format if you are accessing from standard VFP controls and data access methods. Your stored procedure should parse the file correctly. Or am I missing something?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>>What method are you using here:
>>>>>>>>>>
>>>>>>>>>>>and the XML is then sent to VFP database.
>>>>>>>>>
>>>>>>>>>I call VFP Stored procedure using ExecuteScalar() and passing a string (XML).
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform