Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML output does not include DOCTYPE #26

Closed
lilyball opened this issue Apr 30, 2018 · 3 comments
Closed

XML output does not include DOCTYPE #26

lilyball opened this issue Apr 30, 2018 · 3 comments

Comments

@lilyball
Copy link
Contributor

A proper plist includes a DOCTYPE

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

The output from this crates does not include this doctype.

Also, less importantly, the output from Apple's plist code capitalizes the encoding name, i.e.

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

but the output from this crate lowercases it.

@lilyball
Copy link
Contributor Author

Apple's plist code also doesn't indent the child of the <plist> tag.

Ultimately, I'd like to be able to deserialize a plist created from Apple's tools, and then reserialize it, and end up with the exact same file (modulo dictionary key order).

@lilyball
Copy link
Contributor Author

It appears as though Apple's code also indents using hard tabs.

@lilyball
Copy link
Contributor Author

I looked into implementing the DOCTYPE part myself and it doesn't really appear doable with xml-rs. I filed netvl/xml-rs#168 on their end, but in the meantime it looks like the only way to do this is to write out the raw text to the writer prior to constructing the XmlWriter for it. The downside here is it means we would write to the writer immediately in EventWriter::new(), which is fairly odd. Alternatively we could replace the writer with an enum to represent the "we haven't written anything yet" state, but it seems kind of gross.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant