XMLCoder icon indicating copy to clipboard operation
XMLCoder copied to clipboard

Update XMLCoderElement.swift

Open ThePredators opened this issue 4 years ago • 1 comments

The existing implementation was wrong, when the element is empty we set an empty xml tag. We should simply not set it.

Example : structure Test { var Title: String, var description: String? }

In this case calling encode() function like this : let xmlEncoder = XMLEncoder() xmlEncoder.keyEncodingStrategy = XMLEncoder.KeyEncodingStrategy.capitalized let data = try xmlEncoder.encode(self, withRootKey:"Test")

Result in : <Test><Title>"Test"</Title><Description /></Test>

The update I made will simply return this instead of an xml string containing an empty element : <Test><Title>"Test"</Title></Test>

ThePredators avatar Oct 26 '21 09:10 ThePredators

Hi @ThePredators, would you be interested to move this PR forward? I'm cleaning up the repository, and if this PR is abandoned and outdated, I'm inclined to close it. Thanks!

MaxDesiatov avatar Jul 17 '22 16:07 MaxDesiatov

I'm closing this PR as abandoned, please feel free to reopen otherwise.

MaxDesiatov avatar Aug 15 '22 15:08 MaxDesiatov