Closed lilyball closed 6 years ago
I've got no objections to fixing #26 and it would be good to have the output match Apple's native plist writer. But as this is hopefully a temporary fix I'd like it to be as minimal as possible.
I think it we set EmitterConfig::perform_escaping(false)
and change EventWriter::write_value
to call xml::escape::escape_str_pcdata
on the text to be written we could just write an XmlEvent::Characters
containing the DTD, XML header before the opening plist tag.
Good idea. Not sure why that didn't occur to me. I'll try it out when I get a chance (hopefully tonight, but no promises).
@ebarnard I've updated the PR to use the approach you suggested.
Thanks!
Change the plist output to match Apple's. This means uppercasing the XML encoding, including a doctype, indenting using hard tabs, and stripping one level of indentation from the file.
The implementation here isn't great, because xml-rs doesn't have any way of emitting a doctype directly (see netvl/xml-rs#168), but it works.
Fixes #26.