Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you just want to write XML (and not create revXMLTrees) you can write your own functions. How about this for a starter:</p> <pre><code>local _tags local _xml local _level local _tabs function q pText return quote &amp; pText &amp; quote end q on startXML put "&lt;?xml version=" &amp; q("1.0") &amp; "?&gt;" &amp; return into _xml put 0 into _level put empty into _tabs put empty into _tags end startXML on startTag pTag put _tabs &amp; "&lt;" &amp; pTag &amp; "&gt;" &amp; return after _xml add 1 to _level put pTag into _tags[_level] put tab after _tabs end startTag on closeTag delete char 1 of _tabs put _tabs &amp; "&lt;/" &amp; _tags[_level] &amp; "&gt;" &amp; return after _xml # Do a 'delete variable _tags[_level]' if you really want to clean the array as you go subtract 1 from _level end closeTag on addAttribute pAttribute, pValue # This should go into the last tag, but as we have "proper XML" so far we can backtrace two chars ("&gt;" and newline) put space &amp; pAttribute &amp; "=" &amp; q(pValue) before char -2 of _xml end addAttribute on writeContent pContent put _tabs &amp; pContent &amp; return after _xml end writeContent on writeNode pNode, pValue put _tabs &amp; "&lt;" &amp; pNode &amp; "&gt;" &amp; pValue &amp; "&lt;/" &amp; pNode &amp; "&gt;" &amp; return after _xml end writeNode getProp xml return _xml end xml </code></pre> <p>Put that script on the card or stack then you can do:</p> <pre><code>startXML startTag "employeetable" startTag "employee" addAttribute "IDNum", 1 startTag "firstName" writeContent "Steve" closeTag writeNode "lastName", "Jobs" writeNode "roomnum", "001" writeNode "phoneExt", "345" writeNode "parkingSlot", "100" closeTag closeTag put the xml of this card into field 1 </code></pre> <p>This is of course not a complete solution as it will not do any validation of your input, and the format might not be exactly what you want, but I guess it can get you started.</p>
 

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