How does IronPython receive the results of GetDescendants() or Elements() from the Linq library.<br><br>PS C:\Documents and Settings\Jonathan\Desktop\IronPython-2.0B3-Bin\IronPython-2.0B3&gt; .\ipy.exe<br>IronPython 2.0 Beta (2.0.0.3000) on .NET 2.0.50727.1433<br>
Copyright (c) Microsoft Corporation. All rights reserved.<br>&gt;&gt;&gt;<br>&gt;&gt;&gt; import clr<br>&gt;&gt;&gt; clr.AddReference(&#39;System.Xml.Linq&#39;)<br>&gt;&gt;&gt; from System.Xml.Linq import XDocument<br>&gt;&gt;&gt; document = &#39;&lt;root&gt;&lt;a&gt;aaa&lt;/a&gt;&lt;b&gt;bbb&lt;/b&gt;&lt;a&gt;ccc&lt;/a&gt;&lt;/root&gt;&#39;<br>
&gt;&gt;&gt; XDocument.Parse(document).Element(&#39;root&#39;).Element(&#39;a&#39;)<br>&lt;System.Xml.Linq.XElement object at 0x0000000000000031 [&lt;a&gt;aaa&lt;/a&gt;]&gt;<br>&gt;&gt;&gt; XDocument.Parse(document).Element(&#39;root&#39;).Elements(&#39;a&#39;)<br>
&lt;System.Xml.Linq.XContainer+&lt;GetElements&gt;d__11 object at 0x0000000000000033 [System.Xml.Linq.XContainer+&lt;GetElements&gt;d__11]&gt;<br>&gt;&gt;&gt; for i in XDocument.Parse(document).Element(&#39;root&#39;).Elements(&#39;a&#39;):<br>
...&nbsp;&nbsp;&nbsp;&nbsp; print i<br>...<br>&gt;&gt;&gt;<br><br>The for loop doesn&#39;t return any result, but it also doesn&#39;t raise an exception. The MSDN documentation has only examples for c# which all use the &quot;from ... select ....&quot; syntax from Linq which isn&#39;t available here.<br>
<br>Jonathan<br><br><br><br><br><div class="gmail_quote">2008/6/18 Jonathan Slenders &lt;<a href="mailto:jonathan@slenders.be">jonathan@slenders.be</a>&gt;:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thank you, Michael<br><br>I had to:<br><br>import clr<br>clr.AddReference(&#39;System.Xml.Linq&#39;)<br><br><br><br><div class="gmail_quote">2008/6/17 Michael Foord &lt;<a href="mailto:fuzzyman@voidspace.org.uk" target="_blank">fuzzyman@voidspace.org.uk</a>&gt;:<div>
<div></div><div class="Wj3C7c"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello Jonathan,<br>
<br>
Do you need to add a reference to the assembly before importing from it?<br>
<br>
In the Silverlight chapter of IronPython in Action I use &#39;XmlReader&#39; for parsing XML. I have already (in an earlier chapter) provided a wrapper over this that gives it a SAX like interface. The code worked unmodified on Silverlight!<br>


<br>
Michael Foord<br>
<br>
Jonathan Slenders wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>
Hello,<br>
<br>
It seems that XmlDocument isn&#39;t available in Silverlight. The Linq dll (&quot;System.Xml.Linq.dll&quot;) is listed between the client libraries, but when I add them to my Silverlight manifest file<br>
and try:<br>
<br>
from System.Xml.Linq import XDocument<br>
<br>
The following error occurs: &quot;ManagedRuntimeError, SetProperty failed&quot;<br>
<br>
What&#39;s the recommended way to query XML documents? A good XML library is essential at the client for doing AJAX (in our case: APAX), I wonder in the first place why XmlDocument isn&#39;t in Silverlight by default.<br>


I don&#39;t want to use a SAX parser like XmlReader.<br>
<br>
Jonathan<br>
<br>
<br>
PS: When the XML parsing works, I can present a working APAX example for querying a mysql database. It returns row after row every time the client does a request for the next row. The javascript version works, and I&#39;m porting it now to Silverlight/IronPython.<br>

</div></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
 &nbsp;<br>
</blockquote>
<br>
<br>
-- <br>
<a href="http://www.ironpythoninaction.com/" target="_blank">http://www.ironpythoninaction.com/</a><br>
<a href="http://www.theotherdelia.co.uk/" target="_blank">http://www.theotherdelia.co.uk/</a><br>
<a href="http://www.voidspace.org.uk/" target="_blank">http://www.voidspace.org.uk/</a><br>
<a href="http://www.ironpython.info/" target="_blank">http://www.ironpython.info/</a><br>
<a href="http://www.resolverhacks.net/" target="_blank">http://www.resolverhacks.net/</a><br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</blockquote></div></div></div><br>
</blockquote></div><br>