How does IronPython receive the results of GetDescendants() or Elements() from the Linq library.
PS C:\Documents and Settings\Jonathan\Desktop\IronPython-2.0B3-Bin\IronPython-2.0B3> .\ipy.exe IronPython 2.0 Beta (2.0.0.3000) on .NET 2.0.50727.1433 Copyright (c) Microsoft Corporation. All rights reserved. >>> >>> import clr >>> clr.AddReference('System.Xml.Linq') >>> from System.Xml.Linq import XDocument >>> document = '<root><a>aaa</a><b>bbb</b><a>ccc</a></root>' >>> XDocument.Parse(document).Element('root').Element('a') <System.Xml.Linq.XElement object at 0x0000000000000031 [<a>aaa</a>]> >>> XDocument.Parse(document).Element('root').Elements('a') <System.Xml.Linq.XContainer+<GetElements>d__11 object at 0x0000000000000033 [System.Xml.Linq.XContainer+<GetElements>d__11]> >>> for i in XDocument.Parse(document).Element('root').Elements('a'): ... print i ... >>> The for loop doesn't return any result, but it also doesn't raise an exception. The MSDN documentation has only examples for c# which all use the "from ... select ...." syntax from Linq which isn't available here. Jonathan 2008/6/18 Jonathan Slenders <[EMAIL PROTECTED]>: > Thank you, Michael > > I had to: > > import clr > clr.AddReference('System.Xml.Linq') > > > > 2008/6/17 Michael Foord <[EMAIL PROTECTED]>: > > Hello Jonathan, >> >> Do you need to add a reference to the assembly before importing from it? >> >> In the Silverlight chapter of IronPython in Action I use 'XmlReader' 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! >> >> Michael Foord >> >> Jonathan Slenders wrote: >> >>> Hello, >>> >>> It seems that XmlDocument isn't available in Silverlight. The Linq dll >>> ("System.Xml.Linq.dll") is listed between the client libraries, but when I >>> add them to my Silverlight manifest file >>> and try: >>> >>> from System.Xml.Linq import XDocument >>> >>> The following error occurs: "ManagedRuntimeError, SetProperty failed" >>> >>> What'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't in Silverlight by default. >>> I don't want to use a SAX parser like XmlReader. >>> >>> Jonathan >>> >>> >>> 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'm >>> porting it now to Silverlight/IronPython. >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Users mailing list >>> Users@lists.ironpython.com >>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >>> >>> >> >> >> -- >> http://www.ironpythoninaction.com/ >> http://www.theotherdelia.co.uk/ >> http://www.voidspace.org.uk/ >> http://www.ironpython.info/ >> http://www.resolverhacks.net/ >> >> _______________________________________________ >> Users mailing list >> Users@lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > >
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com