How to preserving XML tag string formats in variables?
Jim Ault
jimaultwins at yahoo.com
Sat May 21 11:08:14 EDT 2011
On May 21, 2011, at 7:12 AM, Keith Clarke wrote:
> Hi folks,
> I'm experimenting with scripting the building of a POST message. So,
> I'm creating a set of lines that take the form
> "<opening_tag_string>" & tVariable & "</closing_tag_string>" and
> using a repeat loop to build each component of each lines into a
> variable tMessage.
>
> When I use 'add return & "opening–tag–string" & tVariable after
> tMessage' to create a partial XML node statement, I get what I would
> expect to see in the message box when I put tMessage.
>
> However, when I attempt to 'add return & "opening–tag–string" &
> tVariable & "closing_tag_string" after tMessage' to create the full
> statement, the opening and closing tag strings disappear and I'm
> left with just the list of tVariable in tMessage.
>
> I guess there is some wrapping or encoding that I need to apply to
> the tag strings to preserve them inside the variable, but I can't
> seem to find anything in the docs or the lists - I'm obviously using
> the wrong search terms.
>
> Any clues gratefully received.
You want to study the page in the dictionary
HTMLtext
There are a limited number of tags that livecode recognizes and thus
allows formatting of fields much like the early web pages.
The message box is simply a field in a stack, and
when debugging HTML and other code/encoded/decoded strings, the
message box is a very poor tool.
Save yourself some headaches and put the text strings into a good text
processor that won't automatically do things like change line endings
from Unix to Windows, etc. I use BBEdit, others use TextWrangler, and
a search of the archives will show others.
Further caution is needed if using UTF8 or uinicode, since character
sets across platforms, servers, and software packages can create hard-
to-detect bugs.
Jim Ault
Las Vegas
More information about the use-livecode
mailing list