Consider the following C# code:
XmlTextWriter writer = new XmlTextWriter(pathFichier, null);
writer.WriteStartDocument();
writer.WriteDocType("plist", "-//Apple//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
writer.WriteStartElement("plist");
writer.WriteAttributeString("version", "1.0");
writer.WriteFullEndElement(); // plist
writer.Close();
A PList doctype is usually:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
The above code adds an empty subset at the end of the doctype string:
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"[]>
The "[]" at the end screws with iOs's parsing.
How can I get rid of it using XmlTextWriter ?
Should I just reopened the file and delete the "[]" ?
You can derive a class for XmlTextWriter and override the WriteDocType method.
It'd look something like this:
EDIT by the guy who asked the question. Here's the code I wrote to make it work.
The WriteDocType override:
Its usage in the wild: