Improve heuristic for XML property lists #6119
Merged
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.
Description
Some XML property lists lack a
<!DOCTYPE
[^1] and/or XML signature[^2], and neither omission impacts the file's well-formedness (according to Xcode). Apparently, the only hard requirement is well-formed—though not necessarily valid—XML syntax.This PR amends the heuristic for XML property list so it matches
.plist
files that:<plist>
(with or without aversion
attribute),<!DOCTYPE plist
.Case 1 could extend to other data-type tags as well (especially
<array>
and<dict>
), but the grammar we're using highlights such tags as invalid when they appear outside of a<plist>
element:Example 1: <array>
Example 2: <dict>
Checklist
(Template removed as it doesn't apply)
Sample files
ff-man.plist
man(1)
man.plist
info.min.plist
Footnotes
https://github.com/apple-oss-distributions/man/blob/54b31db2a21b33fe587826dbce22bac7ac775dce/ff-man.plist
https://github.com/apple-oss-distributions/man/blob/54b31db2a21b33fe587826dbce22bac7ac775dce/man.plist
Specifically,
/Applications/cool-retro-term.app/Contents/Info.plist
. Newlines were stripped in order to assert that XML declaration matching is working.