I don't know if there's a better way to do it, but you can do this:

XmlTextWriter writer = new XmlTextWriter("C:\\test.xml", Encoding.UTF8);
writer.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
//write some elements
Writer.Close();

Adam..

-----Original Message-----
From: Dean Cleaver [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 1:51 AM
To: [EMAIL PROTECTED]
Subject: [DOTNET] More XMLSerialisation options...


Ok,

I gave up on the serialisation of classes, and went for the XmlTextWriter
approach - gave me a bit more control.

But there's one thing I can't seem to do - and that's set the first line to
be:

<?xml version="1.0" encoding="UTF-8"?>

I can only get the "<?xml version="1.0"?>" portion to come out, or with the
Standalone property as well. Any suggestions on where to look?

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to