CoreOffice / XMLCoder

Easy XML parsing using Codable protocols in Swift
https://coreoffice.github.io/XMLCoder/
MIT License
801 stars 112 forks source link

Error thrown when decoding multiple attributes #241

Open Joebayld opened 2 years ago

Joebayld commented 2 years ago

Does this library support multiple attributes?

Decoding something like this throws an error.

<MyObject>
    <Item id="1" value="ok">Hello</Item>
    <Item id="2" name=”not-ok”>Goodbye</Item>
</MyObject>

The error thrown is "Error Domain=NSXMLParserErrorDomain Code=111 "(null)""

Any ideas?

SwapnilNighot commented 2 years ago

did you manage to resolve this issue ? I am also facing the same issue.

Jason-Abbott commented 2 years ago

FWIW, I thought I had this issue, to the point that I forked the project and began adding a test to find the problem. But the test passed—lots of attributes, all good. So I pasted my XML into the test and it failed.

It turned out I had an extraneous comma (,) between a couple elements.

With that sorted, my current project is parsing elements with dozens of attributes and child elements, no problem.

Joannis commented 2 years ago

I'll leave this open for a bit for @SwapnilNighot . Let me know what the current status is. If it becomes stale for another month or so I'll close it.