Skip to content

Avoid a deprecation warning in FoundationXML when initializing XMLElement instances by initializing them as comments #5

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nglevin
Copy link

@nglevin nglevin commented Jun 6, 2024

When initialized via the default initializer, the swift-foundation version of XMLElement will initialize each instance as ".invalid" via the XMLNode implementation that it inherits from.

This will also print out a deprecation warning when compiling that discourages all uses of the default XMLElement initializer, as seen in https://github.com/apple/swift-corelibs-foundation/blob/main/Sources/FoundationXML/XMLNode.swift#L108

To mitigate this, this change initializes all of the XMLElement instances in this project as ".comment" instances. This does not change the output of XMLDocument in system Foundation or the open source swift-foundation as far as swift-ordered-plist-encoder's implementation is concerned, and it successfully suppresses the warning when compling.

…ult initializer, suppressing a warning in OSS XMLElement.
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

Successfully merging this pull request may close these issues.

1 participant