blob: 1fe8280a5f423b547f9049a22851a5f1bef638ed [file] [log] [blame]
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>xml</title><link rel="stylesheet" type="text/css" href="rivet.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="Apache Rivet 3.0"><link rel="up" href="commands.html" title="Rivet Tcl Commands and Variables"><link rel="prev" href="wrapline.html" title="wrapline"><link rel="next" href="examples.html" title="Examples and Usage"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">xml</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="wrapline.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center">Rivet Tcl Commands and Variables</th><td width="20%" align="right"> <a accesskey="n" href="examples.html"><img src="images/next.png" alt="Next"></a></td></tr></table></div><div class="refentry"><div class="refentry.separator"><hr></div><a name="xml"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>xml —
XML Fragments creation
</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::xml</span> ?<span style="font-family:monospace; font-weight: bold;">string</span>? ?<span style="font-family:monospace; font-weight: bold;">tag descriptor</span>? ?<span style="font-family:monospace; font-weight: bold;">tag descriptor</span>? ?<span style="font-family:monospace; font-weight: bold;">...</span>?</div></div></div><div class="refsect1"><a name="idm45412676425072"></a><h2>Description</h2><p style="width:90%">
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 namme and the remaining elements are interpreted as
attribute name-attribute value pairs.
</p><p style="width:90%">
<span style="font-family:monospace"><span class="command"><strong>::rivet::xml</strong></span></span> can work as a replacement of <span style="font-family:monospace"><span class="command"><strong>::rivet::html</strong></span></span>
provided you take care of sending the string with command <span style="font-family:monospace"><span class="command"><strong>puts</strong></span></span>
</p><pre class="programlisting">::rivet::xml "a string" b u
&lt;== &lt;b&gt;&lt;u&gt;a string&lt;/u&gt;&lt;/b&gt;</pre><p style="width:90%">
You can tell the tags which attributes they must have
</p><pre class="programlisting"><span style="font-family:monospace"><span class="command"><strong>::rivet::xml "a string" [list div class box id testbox] b i</strong></span></span>
&lt;== &lt;div class="box" id="testbox"&gt;&lt;b&gt;&lt;i&gt;a string&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;</pre><pre class="programlisting"><span style="font-family:monospace"><span class="command"><strong>::rivet::xml "text to be wrapped in XML" div [list a href "http://..../" title "info message"]</strong></span></span>
&lt;== &lt;div&gt;&lt;a href="http://..../" title="info message"&gt;text to be wrapped in XML&lt;/a&gt;&lt;/div&gt;</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="wrapline.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="commands.html"><img src="images/up.png" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="examples.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">wrapline </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> Examples and Usage</td></tr></table></div></body></html>