<div>
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">"Can you write recursive functions to dive an object?"</span>
<br></div><div><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><br></span></div><div><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I've got a snorkel and some flippers - will that help :-)<br>
</span></div><div><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><br></span></div><div><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This sounds like a fun project for when I have got the current release out of the way. I would like to have a save and restore facility for the scenario connector page. I think I have only used recursion once in all the time I've been programming so the current answer to your question would be no - but things change.<br>
</span></div><div><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><br></span></div><div><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">If we release the current version of the page in 2.18 it should be a simple swap out of the rlm file at a later date if I can get it working.<br>
</span></div><div><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><br></span></div><div><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Kind regards<br>
</span></div><div><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><br></span></div><div><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Johnathan<br>
</span></div><br><div class="gmail_quote">On 7 March 2012 15:18, Julian Tenney <span dir="ltr"><<a href="mailto:Julian.Tenney@nottingham.ac.uk">Julian.Tenney@nottingham.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Perfectly feasible, but xerte hasn’t got one.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Can you write recursive functions to dive an object? </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Look at the code behind inspect() in the engine. You could modify that.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal" style="margin-left:36.0pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:xerte-bounces@lists.nottingham.ac.uk" target="_blank">xerte-bounces@lists.nottingham.ac.uk</a> [mailto:<a href="mailto:xerte-bounces@lists.nottingham.ac.uk" target="_blank">xerte-bounces@lists.nottingham.ac.uk</a>] <b>On Behalf Of </b>Kemp Johnathan<br>
<b>Sent:</b> 07 March 2012 15:17</span></p><div><div class="h5"><br><b>To:</b> Xerte discussion list<br><b>Subject:</b> [Xerte] Re: Converting an object to xml</div></div></div><div><div class="h5"><p class="MsoNormal" style="margin-left:36.0pt">
 </p><div><p class="MsoNormal" style="margin-left:36.0pt">The problem I was trying to solve was one of having an object in a page, being able to dump that object as xml data to a file and then being able to recreate that object from the xml data by reloading the file at a later date.</p>
</div><div><p class="MsoNormal" style="margin-left:36.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:36.0pt">So if you started with the object</p></div><div><p class="MsoNormal" style="margin-left:36.0pt">node[0].att</p>
</div><div><p class="MsoNormal" style="margin-left:36.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:36.0pt">When it was converted to xml would it matter if it was generated as </p></div><div><p class="MsoNormal" style="margin-left:36.0pt">
 </p></div><div><p class="MsoNormal" style="margin-left:36.0pt"><node att="value"></p></div><div><p class="MsoNormal" style="margin-left:36.0pt">or</p></div><div><p class="MsoNormal" style="margin-left:36.0pt">
<node><att>value</att></node></p></div><div><p class="MsoNormal" style="margin-left:36.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:36.0pt">since either approach would recreate as an object as </p>
</div><div><p class="MsoNormal" style="margin-left:36.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:36.0pt">node[0].att</p></div><div><p class="MsoNormal" style="margin-left:36.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:36.0pt">
I can understand that if you were starting with the xml you would not know which format of xml to create when converting back from the object you created and that therefore you could end up with a different XML structure to that which you started with. But if you were starting off from the object, would it not be feasible to have a conversion routine that always adopted the same approach when converting from an object to the xml data. Thus making it possible to consistently convert from the object to the xml and back again? (I know I am talking theoretically here - how you would achieve it I am not currently sure).</p>
</div><div><p class="MsoNormal" style="margin-left:36.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:36.0pt">Is there something fundamental about xml that I am failing to grasp here?</p></div><div><p class="MsoNormal" style="margin-left:36.0pt">
 </p></div><div><p class="MsoNormal" style="margin-left:36.0pt">Kind regards</p></div><div><p class="MsoNormal" style="margin-left:36.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:36.0pt">Johnathan</p></div>
<div><p class="MsoNormal" style="margin-left:36.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:36.0pt">On 7 March 2012 12:05, Julian Tenney <<a href="mailto:Julian.Tenney@nottingham.ac.uk" target="_blank">Julian.Tenney@nottingham.ac.uk</a>> wrote:</p>
<div><div><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I don’t think you’re going to get bi-directional because</span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><node att=”value”> is node[0].att and <node><att>value</att></node> is node[0].att</span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:72.0pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:xerte-bounces@lists.nottingham.ac.uk" target="_blank">xerte-bounces@lists.nottingham.ac.uk</a> [mailto:<a href="mailto:xerte-bounces@lists.nottingham.ac.uk" target="_blank">xerte-bounces@lists.nottingham.ac.uk</a>] <b>On Behalf Of </b>Kemp Johnathan</span></p>
<div><p class="MsoNormal" style="margin-left:36.0pt"><br><b>Sent:</b> 07 March 2012 11:21<br><b>To:</b> Xerte discussion list</p></div><p class="MsoNormal" style="margin-left:36.0pt"><b>Subject:</b> [Xerte] Re: Converting an object to xml</p>
</div><div><div><p class="MsoNormal" style="margin-left:72.0pt"> </p><div><p class="MsoNormal" style="margin-left:72.0pt">What I was hoping to achieve was a bi-directional capability i.e.</p></div><div><p class="MsoNormal" style="margin-left:72.0pt">
 </p></div><div><p class="MsoNormal" style="margin-left:72.0pt">you could go back and forth, perhaps creating your initial object from xml data, then modify the object in a page, then save it out as xml again. Then the next time you load the page you have the option of restoring a your previously saved data.</p>
</div><div><p class="MsoNormal" style="margin-left:72.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:72.0pt">Kind regards</p></div><div><p class="MsoNormal" style="margin-left:72.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:72.0pt">
Johnathan</p></div><p class="MsoNormal" style="margin-left:72.0pt"> </p><div><p class="MsoNormal" style="margin-left:72.0pt">On 7 March 2012 11:03, Julian Tenney <<a href="mailto:Julian.Tenney@nottingham.ac.uk" target="_blank">Julian.Tenney@nottingham.ac.uk</a>> wrote:</p>
<div><div><p class="MsoNormal" style="margin-left:72.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Good question. No, not currently. Have a look for a prototype extension and I can build it in if it does what you want: it would probably not create attributes, rather full nodes for each value, and it would have to make some assumptions when naming things I think:</span></p>
<p class="MsoNormal" style="margin-left:72.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><p class="MsoNormal" style="margin-left:72.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><object></span></p>
<p class="MsoNormal" style="margin-left:72.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">  <property>value</property></span></p><p class="MsoNormal" style="margin-left:72.0pt">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">  <array></span></p><p class="MsoNormal" style="margin-left:72.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">    <item>value</item></span></p>
<p class="MsoNormal" style="margin-left:72.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">    ….</span></p><p class="MsoNormal" style="margin-left:72.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">  </array></span></p>
<p class="MsoNormal" style="margin-left:72.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">…</span></p><p class="MsoNormal" style="margin-left:72.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"></object></span></p>
<p class="MsoNormal" style="margin-left:72.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span></p><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:108.0pt"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:xerte-bounces@lists.nottingham.ac.uk" target="_blank">xerte-bounces@lists.nottingham.ac.uk</a> [mailto:<a href="mailto:xerte-bounces@lists.nottingham.ac.uk" target="_blank">xerte-bounces@lists.nottingham.ac.uk</a>] <b>On Behalf Of </b>Kemp Johnathan<br>
<b>Sent:</b> 07 March 2012 10:40<br><b>To:</b> Xerte discussion list<br><b>Subject:</b> [Xerte] Converting an object to xml</span></p></div><div><div><p class="MsoNormal" style="margin-left:108.0pt"> </p><div><p class="MsoNormal" style="margin-left:108.0pt">
Xerte has the myXML.toObject() method that will construct an object from xml data.</p></div><div><p class="MsoNormal" style="margin-left:108.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:108.0pt">Is there an easy way to go in the other direction and convert an object into XML data?</p>
</div><div><p class="MsoNormal" style="margin-left:108.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:108.0pt">Kind regards</p></div><div><p class="MsoNormal" style="margin-left:108.0pt"> </p></div><div><p class="MsoNormal" style="margin-left:108.0pt">
Johnathan</p></div></div></div></div><p class="MsoNormal" style="margin-left:72.0pt"> </p><p style="margin-left:72.0pt">This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. </p>
<p style="margin-left:72.0pt">This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. </p>
</div><p class="MsoNormal" style="margin-bottom:12.0pt;margin-left:72.0pt"><br>_______________________________________________<br>Xerte mailing list<br><a href="mailto:Xerte@lists.nottingham.ac.uk" target="_blank">Xerte@lists.nottingham.ac.uk</a><br>
<a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte" target="_blank">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a><br><br>This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<br>
<br>This message has been checked for viruses but the contents of an attachment<br>may still contain software viruses which could damage your computer system:<br>you are advised to perform your own checks. Email communications with the<br>
University of Nottingham may be monitored as permitted by UK legislation.</p></div><p class="MsoNormal" style="margin-left:72.0pt"> </p></div></div></div></div><p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt">
<br>_______________________________________________<br>Xerte mailing list<br><a href="mailto:Xerte@lists.nottingham.ac.uk" target="_blank">Xerte@lists.nottingham.ac.uk</a><br><a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte" target="_blank">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a><br>
<br>This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<br>
<br>This message has been checked for viruses but the contents of an attachment<br>may still contain software viruses which could damage your computer system:<br>you are advised to perform your own checks. Email communications with the<br>
University of Nottingham may be monitored as permitted by UK legislation.<br><br></p></div><p class="MsoNormal" style="margin-left:36.0pt"> </p></div></div></div></div><br>_______________________________________________<br>

Xerte mailing list<br>
<a href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a><br>
<a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte" target="_blank">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a><br>
<br>
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.<br>

<br>
This message has been checked for viruses but the contents of an attachment<br>
may still contain software viruses which could damage your computer system:<br>
you are advised to perform your own checks. Email communications with the<br>
University of Nottingham may be monitored as permitted by UK legislation.<br>
<br>
<br></blockquote></div><br>