Hi,<br><br>I was wondering whether there is a better way (or an elegant &#39;pattern&#39;) to construct an xml document. Lets say I have many variables(can be lists, dicts, strings etc) and the corresponding values, so some tags have just one text value whereas some have siblings etc and also have their respective attributes. Is it possible to construct the XML just based on this structure of variables. <br>
<br>I am not sure whether I am framing my Q right, but let me explain it with an example:<br>strtag=&quot;Hello World&quot;<br>listtag = [10,20,30]<br>dicttag={&#39;a&#39;:100,&#39;b&#39;:200}<br><br>And when the above variables are fed into a black box, i get the output xml:<br>
&lt;strtag&gt;Hello World&lt;/strtag&gt;<br>&lt;listtag&gt;10&lt;/listtag&gt;<br>&lt;listtag&gt;20&lt;/listtag&gt;<br>&lt;listtag&gt;30&lt;/listtag&gt;<br>&lt;dicttag&gt;<br>  &lt;a&gt; 100&lt;/a&gt;<br>  &lt;b&gt; 200&lt;/b&gt;<br>
&lt;/dicttag&gt;<br><br>The above example &#39;again&#39; might not make sense exactly in terms of how the black box deciphers how the xml hierarchy can be maintained; I am looking for a better example !!<br><br clear="all">
-V-<br><a href="http://twitter.com/venkasub">http://twitter.com/venkasub</a><br>