I have a simple little project open a xml file change a few nodes save the
file, no big deal.
The problem is that the doctype is getting modified when I save the file.
So it looks like this: <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
But when I save it : <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"[]>
You can see at the end it appends the [] which invalidates the file. No
where in the code do I specifically modify the doctype. Is there a way to
prevent the doctype from getting modified , this appears to be a bug. As a
workaround I¹ve replaced the Doctype node. But this is a kluge.
Snippet
XmlNodeList myList;
XmlDocument myDoc = new XmlDocument();
myDoc.Load("c:\ \inetpub\\wwwro ot\\template.mo bileconfig");
myList= myDoc.GetElemen tsByTagName("ke y");
do some stuff .....
XmlTextWriter w = new XmlTextWriter(" C:\\xmlFiles\\" + username +
".mobileconfig" ,new UTF8Encoding(fa lse));
myDoc.Save(w);