Skip to content

Implement correct xsd:whitespace behaviour #1125

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

Conversation

da1910
Copy link

@da1910 da1910 commented Aug 9, 2020

Closes #1105
XSD spec requires specific treatment of whitespace for builtin types, whilst we cannot control the way any one of hundreds of soap servers return data, we can remove any whitespace that does not conform to the spec. This way we can be confident that the intent of the message is correctly captured.

I've implemented this with a new decorator, much like the @check_no_collections decorator currently used. This allows us to enforce the correct whitespace behaviour for each builtin type.

A summary of the desired behaviour is:

  • String preserves whitespace,
  • NormalizedString replaces \r\n\t with spaces
  • Token and all other atomic types collapse multiple spaces and leading and trailing spaces

I have also added new asserts to check this behaviour for existing builtin tests, and added new tests for NormalizedString and Token which verify this behaviour. This breaks no existing tests, since we only provided valid inputs.

- String preserves whitespace,
- NormalizedString replaces \r\n\t with spaces
- Token and all other atomic types collapse multiple spaces and leading and trailing spaces
- Add asserts to existing builtin tests
- Add new tests for NormalizedString and Token
@mvantellingen mvantellingen merged commit 59a8f87 into mvantellingen:master Sep 26, 2020
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.

Value "true" parsed as Python boolean "False"
2 participants