Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replace Less Than and Greater Than in an XML strin
Message
From
17/10/2018 18:13:32
 
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
01662634
Message ID:
01662648
Views:
36
>>>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 &lt;. That is
>>
>>
>>XMLTOCURSOR("<root><row><field1>&lt;</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
&lg;,
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 &lt;, or > into &gt; 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 &lt; and &gt;. 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.
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform