Open pcantrell opened 3 years ago
The problem appears to stem from the parsing trying to apply XMLChoiceDecodingContainer
to XML text elements that contain nothing but whitespace. Stripping all whitespace from between tags in the XML makes at least the HelloWorld test pass.
…and the problem seems to have appeared in this commit whose message is “flag failing test,” so I take it you’re already aware of the problem?
Note that if I set trimValueWhitespaces
to false
throughout the project, it fixes the issues — but then tests that seem to be explicitly testing for whitespace preservation fail.
More debugging: It works pointing at XMLCoder’s commit that merged @bwetherfield’s https://github.com/MaxDesiatov/XMLCoder/pull/155, but fails with the next commit in XMLCoder’s history, which merges https://github.com/MaxDesiatov/XMLCoder/pull/157. It looks like MusicXML had relied on XMLCoder stuffing all the intervening whitespace into the element’s value
, as that latter PR describes, and doesn’t know how to skip the newly added intervening text nodes that contain nothing but whitespace.
The internals of the XML parsing are pretty foggy to me, but it looks like one of the following things needs to happen:
trimValueWhitespaces
that drops text nodes that contain only whitespace, but preserves whitespace in text nodes that contain non-whitespace.
When I do a clean checkout of the project and run tests, either with
swift test
from the command line or in Xcode, I get 6 similar-looking failures:Is this expected — the current HEAD just in an intermediate state? Or is it a regression with a newer version of Swift, perhaps? I’m using 5.3.1.