[MonoTouch] Linq XElement.ReadFrom(reader) bug...
Phil Jepsen
jepsen at gmail.com
Mon Nov 9 02:21:00 EST 2009
http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/02f6054ed14bc3c8
On Sun, Nov 8, 2009 at 10:48 PM, Phil Jepsen <jepsen at gmail.com> wrote:
> Hmmmm.... seems to be my XML.
>
> If I parse the XML first like so:
>
> XDocument pxml = XDocument.Parse(xml);
>
> Then use this with the XmlReader I get all 1000 records.
>
> Anyone have any idea whats going on here??
>
> Thanks,
>
> Phil Jepsen
>
>
>
>
> On Sun, Nov 8, 2009 at 10:36 PM, Phil Jepsen <jepsen at gmail.com> wrote:
>
>> 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/ffa38c34/attachment.html
More information about the MonoTouch
mailing list