Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to deal with ampersend sign?
Message
 
 
À
02/01/2008 14:13:25
Information générale
Forum:
ASP.NET
Catégorie:
XML
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01278970
Message ID:
01279055
Vues:
25
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).
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform