Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The version control library by Mark Wieder (public domain) contains some XML writing procedures which might be considered.</p> <p><a href="http://revonline2.runrev.com/stack/686/libVersionControl" rel="nofollow">http://revonline2.runrev.com/stack/686/libVersionControl</a></p> <pre><code>--&gt; xml /** ------------------------------ * XML.StartTag * * Return &lt;tag&gt; * Convert embedded commas and spaces as part of the process. * ------------------------------ */ private function XML.StartTag pTag if comma is in pTag then replace comma with kMagicComma in pTag end if if "&amp;" is in pTag then replace "&amp;" with kAmpersand in pTag end if if space is in pTag and "=" is not in pTag then replace space with kMagicSpace in pTag end if return "&lt;" &amp; pTag &amp; "&gt;" end XML.StartTag /** ------------------------------ * XML.EndTag * * Return &lt;/tag&gt; * Convert embedded commas and spaces as part of the process. * * @pTag : the tag of interest * ------------------------------ */ private function XML.EndTag pTag if comma is in pTag then replace comma with kMagicComma in pTag end if if space is in pTag and "=" is not in pTag then replace space with kMagicSpace in pTag end if return "&lt;/" &amp; pTag &amp; "&gt;" &amp; cr end XML.EndTag /** ------------------------------ * XML.Element * * return &lt;tag&gt;value&lt;/tab&gt; * base64encode the value item if necessary * ------------------------------ */ private function XML.Element pTag, pValue local tIsBinary local tTest put false into tIsBinary if pTag is in "htmlText, script, imagedata" then put true into tIsBinary else repeat for each byte tByte in pValue put chartonum(tByte) into tTest -- see if the char is printable if tTest &lt; 32 or tTest &gt; 128 then put true into tIsBinary -- no need to look further exit repeat end if end repeat end if -- can't have binary data in xml if tIsBinary then put "base64decode(" &amp;&amp; q(base64encode(pValue)) &amp;&amp; ")" into pValue end if return XML.StartTag(pTag) &amp; pValue &amp; XML.EndTag(pTag) end XML.Element --&gt; Utilities function q pText return quote &amp; pText &amp; quote end q </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload