>>>>Hi,
>>>>
>>>>The suggestion from Antonio Lopes and Borislav to replace Ampersand (to &emp;) in an XML string is very helpful.
>>>>
>>>>But I also need to replace the greater than
(>)
and less than
(<)
symbols in the XML string. Since my initial string has these symbols for "business" reasons, I cannot use the STRTRAN() suggested by Antonio (since it will replace all the "business/necessary") symbols. So, when storing the data in the table field I need to convert the values of < and > to something else. I can change them to > but then it will look "strange" to the user, when they view it in the report.
>>>>
>>>>I am thinking of double left pointing angle and double right pointing angle (
<< and >>
). But I cannot find their CHR(#) value. Where do I find them (if they exist in VFP)?
>>>
>>>Hi, Dmitry.
>>>
>>>I'm not quite following you in this. When you XMLTOCURSOR() the STRTRANslated strings, you'll get < in the resulting cursor, not <. That is
>>>
>>>
>>>XMLTOCURSOR("<root><row><field1><</field1></row></root>", "test")
>>>? test.field1
>>>
>>>
>>>will print
<
because that will be content of the imported field, and that is what your users will see. Are you getting something else?
>>
>>Hi, Antonio,
>>
>>Let me clarify. The string contains a bunch of "good" greater than characters
>
. And if I convert all
>
to
≶,
this will mess up the formatting of the string. So when I save the user-entered
>
characters, I need to convert them to something different. This is why, when saving user entry, I will convert all
>
to double arrow characters.
>
>Dmitry
>
>You'll only need to translate < into <, or > into > if you want to import the data into a cursor via XMLTOCURSOR(). And when XMLTOCURSOR() passes the XML document to a cursor, it will pass < and >, not < and >. Your string won't change anything.
>
>If you're not going to process the strings with XMLTOCURSOR(), then you don't need to translate them at all.
I agree with you but something does not work (I am sure it is me). Here is the code:
1. When saving a user entry to the field, I change according to this code:
uNewValue = STRTRAN(STRTRAN(uNewValue,"<", "&" + "lt;"), ">", "&" + "gt;")
*-- And I see that in the field the value is
>
- just to validate
2. Then I import the string into the cursor using XMLTOCURSOR(). But the resulting value in the cursor is
>
and not
>
What am I missing?
"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