I had the same problem. I had to go with XmlDocument: XmlNode docNode = doc.CreateXmlDeclaration("1.0", "iso-8859-1", "no"); I'm guessing you are viewing this in a browser instead of a text file. One thing that you may notice is that the "ISO" becomes capitalized in a browser, but if you look at it with a text editor like Notepad, it looks the way you want it. Also, the browser translates "no" to "false". If you want to see what it looks like exactly, use Notepad. You might also try this: XmlSerializer xmlSer = new XmlSerializer(typeof(T)); using (MemoryStream mem = new MemoryStream()) { using (XmlWriter writer = XmlWriter.Create(mem)) { string doubleQuote = ((char)34).ToString(); string s = "version=" + doubleQuote + "1.0" + doubleQuote + " encoding=" + doubleQuote + "iso-8859-1" + doubleQuote + " standalone=" + doubleQuote + "no" + doubleQuote; writer.WriteProcessingInstruction("xml", s); xmlSer.Serialize(writer, objectToSerialize); } }
Francine DeGrood Taylor
Posts
-
How can I add standalone="no" in creating an XML file? -
Cancel - OKWhat about letting users configure it themselves? A simple routine to set the button text and dialog return value for all OK/Cancel buttons would do the trick. That way older users could keep doing things the way they are comfortable with, while new users could do things the "Microsoft Way" if they want. Or you might even get rid of the Cancel buttons. I never saw much use in them myself. The "X" in the upper right corner can be used for the same functionality. I suppose it might make some users more secure having a specific button for abandoning changes, though, just so they could be sure their exit is done in a controlled manner. Although you can code the X to do exactly the same as a Cancel button, it might seem more unsafe to users.
-
Has any programming language ever affected your thought process in real life?Ah, but we're not excusing it, we're celebrating it ;)
-
Has any programming language ever affected your thought process in real life?Huh. Try spending six months doing UI apps in Dataflex, the language that did not do function calls. It's the only langauge I have ever programmed in that I loathed more every single day I used it.