xml — XML Fragments creation


::rivet::xml ?string? ?tag descriptor? ?tag descriptor? ?...?


Given a string and a variable number of tag descriptors return XML fragment made by nesting the tags with the same hierarchical order they are listed on the command line. The tag descriptors can be a one element list (the tag) or an odd-length list whose first argument is the tag name and the remaining elements are interpreted as attribute name-attribute value pairs.

::rivet::xml can work as a replacement of ::rivet::html provided you take care of sending the string with command puts

::rivet::xml "a string" b u
<== <b><u>a string</u></b>

You can tell the tags which attributes they must have

::rivet::xml "a string" [list div class box id testbox] b i
<== <div class="box" id="testbox"><b><i>a string</i></b></div>
::rivet::xml "text to be wrapped in XML" div [list a href "http://..../" title "info message"] 
<== <div><a href="http://..../" title="info message">text to be wrapped in XML</a></div>