[Mono-devel-list] Problem removing elements from an XML

Joris Willems trendzetter at pandora.be
Sat Sep 18 16:10:14 EDT 2004


Joris Willems wrote:

> Hi
>
>
> When I delete a row from a dataset and write it back to XML I get 
> invalid XML. Adding data to the XML is no problem. I am doing the 
> following:
>
>        this.ds.Tables[0].Rows.Remove(pDataRow);
>              FileStream fout = new 
> FileStream("userdata.xml",FileMode.OpenOrCreate,
>                         FileAccess.Write,FileShare.ReadWrite);
>
>        ds.WriteXml(fout);
>
>        fout.Close();
>
> The resulting XML looks like this:
>
>  <item>
>    <PK>8</PK>
>    <name>7700fx.jpg</name>
>    <cost>777</cost>
>    <desc>max</desc>
>    <image>/home/anne/MonoDevelopProjects/GCatalog/7700fx.jpg</image>
>  </item>
> </NewDataSet>x</desc>
>    
> <image>/home/anne/MonoDevelopProjects/GCatalog/5900superlight.jpg</image>
>  </item>
>  <item>
>    <PK>8</PK>
>    <name>7700fx.jpg</name>
>    <cost>777</cost>
>    <desc>max</desc>
>    <image>/home/anne/MonoDevelopProjects/GCatalog/7700fx.jpg</image>
>  </item>
>
> So where you see the </NewDataSet> something is obvious wrong. As I am 
> just learning C# and XML I was unable to determine if this is a bug or 
> if I am doing something wrong.
>
> I am willing to create a bugreport if someone can confirm that this is 
> a bug.
>
> mono version:
> Mono JIT compiler version 1.0.1, (C) 2002-2004 Novell, Inc and 
> Contributors. www.go-mono.com
>        TLS:           __thread
>        GC:            Included Boehm (with typed GC)
>        SIGSEGV      : normal
>        Globalization: ICU
>
> Please let me know if you would like to get additional information.
>
>
> Best regards,
>
> Joris Willems
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>

Ok I found out that it works if I delete the file first.

Joris



More information about the Mono-devel-list mailing list