[MonoTouch] Linq XElement.ReadFrom(reader) bug...

Phil Jepsen jepsen at gmail.com
Mon Nov 9 01:36:26 EST 2009


I'm parsing some xml with XmlReader and have noticed that calling
XElement.ReadFrom(reader) seems to cause the XmlReader to advance a node.

I have 1000 records in my xml, but the following code will always return
~500.  It always skips every second record.

Example:

using (XmlReader reader = XmlReader.Create(new StringReader(xml))
{
     reader.ReadToFollowing("Data");

    while (reader.Read())
    {
           switch (reader.NodeType)
           {
                  case XmlNodeType.Element:
                        if (reader.Name == "Data")
                        {
                                 XElement el = XElement.ReadFrom(reader) as
XElement;     <BUG>

                                  .... Do something with el.
                        }
           }
    }
    reader.Close();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20091108/d4a5abfb/attachment-0001.html 


More information about the MonoTouch mailing list