feat(removeUnknownAndDefaults): apply to xml declarations #1872
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As
standalone="no"
is the default value in the XML declaration, it can be safely removed. I've separated this into a separate parameter of theremoveUnknownsAndDefaults
plugin, and is enabled by default.See: https://www.w3.org/TR/REC-xml/#sec-rmd
Our XML parser doesn't parse the individual properties in the XML declaration, so we just get the full string of all values. Rather than parse it myself, I opted to use a regex to pull out the sole value we're interested in, since it's the only one with a default.
We can revise this in future if we switch library, for example, I know with
txml
we could do a much cleaner implementation:The regex would do the following conversions:
Chores
Array<…>
to…[]
.Related
standalone="no"
from XML declaration #836