PC Review


Reply
Thread Tools Rate Thread

dataset.writexml and diffgrams, not writing well formed xml

 
 
=?Utf-8?B?ZWR3YXJkbXVy?=
Guest
Posts: n/a
 
      4th Sep 2004
Hello,
I am using vb.net and trying to write a local copy of a strongly typed
dataset as a diffgram when the user is offline, so that when they connect to
the server again their changes can be sent back. I am writing the diffgram
using:

dataset.writexml(filename,xmlwritemode.diffgram).

If I load the original data from the server, then write it as a diffgram,
then exit, then run the program again (this time offline) and load the
diffgram, all works fine. However, if I then write the diffgram again, from
the same dataset but this time with the local copy of the data (which has
just been loaded from the diffgram), then exit, then run the program again
and try and load the diffgram I get an xmlexception with errorcode
"Xml_badnamechar" and the message "The ':' character, hexadecimal value 0x3A,
cannot be included in a name. Line 9983, position 49."
This is presumably because one of my field names includes a ':' (which I now
suspect may have been a mistake!). But why does it not cause a problem the
first time round, and is there anyway of making writexml encode the offending
characters?

I would be very grateful for any help,

Edward Murray
 
Reply With Quote
 
 
 
 
=?Utf-8?B?RmxpcA==?=
Guest
Posts: n/a
 
      5th Nov 2004
Hi,

I am having exactly the same problem:
The first time I load a stronlgy-typed dataset from the (SQL-) server and
write it as a diffgram with MyDataset.WriteXml(fileTemp,
xmlWriteMode.DiffGram), I get a well-formed xml file that I can reload again
with MyDataset.ReadXml(fileTemp, xmlReadMode.DiffGram). The first time I
execute this, fileTemp does not exist yet and is created by the call to
WriteXML.

The second time I execute the same code, fileTemp does exist and should be
overwritten by the call to WriteXml. But it produces badly formed xml instead.

I suspect that this has nothing to do with a bad field name, but with the
way the output file is opened.

What is 'filename' in your code? Is it a Stream, a TextWriter, or a String
with the path to a file? I have the feeling that this works if you use a file
path, but not when you use a stream.

Can you send (part of) the resulting xml file, so that I can verify whether
you get a similar result as me? In my case, some of the xml is repeated after
the closing </diffgr:diffgram> tag.

Thnx in advance,

Flip


"edwardmur" wrote:

> Hello,
> I am using vb.net and trying to write a local copy of a strongly typed
> dataset as a diffgram when the user is offline, so that when they connect to
> the server again their changes can be sent back. I am writing the diffgram
> using:
>
> dataset.writexml(filename,xmlwritemode.diffgram).
>
> If I load the original data from the server, then write it as a diffgram,
> then exit, then run the program again (this time offline) and load the
> diffgram, all works fine. However, if I then write the diffgram again, from
> the same dataset but this time with the local copy of the data (which has
> just been loaded from the diffgram), then exit, then run the program again
> and try and load the diffgram I get an xmlexception with errorcode
> "Xml_badnamechar" and the message "The ':' character, hexadecimal value 0x3A,
> cannot be included in a name. Line 9983, position 49."
> This is presumably because one of my field names includes a ':' (which I now
> suspect may have been a mistake!). But why does it not cause a problem the
> first time round, and is there anyway of making writexml encode the offending
> characters?
>
> I would be very grateful for any help,
>
> Edward Murray

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dataset.writeXML not writing tables briforge@yahoo.com Microsoft Dot NET Compact Framework 2 3rd Feb 2005 07:35 PM
Filling a Dataset and Dataset.WriteXML method.. Serdar C Microsoft C# .NET 3 31st Dec 2004 08:07 AM
Synch via DataSet DiffGrams - is there a flaw here? =?Utf-8?B?U2ltb24gS2V3aW4=?= Microsoft ADO .NET 4 18th Mar 2004 11:42 PM
Writing null values using WriteXML() D Microsoft ADO .NET 1 25th Nov 2003 04:24 AM
dataset.writexml using dtd judy Microsoft C# .NET 1 31st Jul 2003 04:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:13 PM.