Closed MLKrisJohnson closed 3 years ago
This a bug as this library aims to match the output of Apple's tools for XML plists.
Let's add .pad_self_closing(false)
, there are unreleased changes that require a minor version bump so now would be a good time to change this.
Fixed in 1a9bf1e9.
I've been using the
plist
crate to generate files used for code-signing iOS applications. One of the necessary files is an "entitlements" plist. When I useplist::to_writer_xml()
to serialize one of these structures to a file, the result is this:This is valid XML. However, the XML parser used in Apple's
codesign
utility does not accept the space in<true />
as valid, so attempts to use this as-is fail.I can workaround this in my code by writing the serialized XML to a buffer and then substituting a space-less
<true/>
before writing to disk. However, I think this problem could be fixed by adding.pad_self_closing(false)
to theEmitterConfig
that is used instream::XmlWriter::new()
, or by adding a variant ofto_writer_xml()
that accepts a customEmitterConfig
, or by adding another option toXmlWriteOptions
.I'm willing to submit a PR with the necessary changes. But I'd like to know which fix is preferred: change the default EmitterConfig, or add an alternate method that allows configuration. The "one-line fix" of adding
.pad_self_closing(false)
requires a corresponding change to thestream::xml_writer::tests::streaming_parser
unit test.