Skip to content
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

Cross decoding #48

Merged
merged 2 commits into from
Feb 27, 2025
Merged

Cross decoding #48

merged 2 commits into from
Feb 27, 2025

Conversation

einarmo
Copy link
Contributor

@einarmo einarmo commented Feb 27, 2025

Support for XML in JSON, and XML in binary.

This isn't strictly speaking in the spec, but I skip whitespace when parsing the base64 string. The reason for this is that it is super common in XML (at least) to assume that whitespace is ignored, even the base nodeset does this, though the XML standard does include whitespace in text bodies, so it's technically wrong, but we are better off ignoring it, even at a small performance penalty.

Apart from that this also changes JSON extension objects to use UaTypeId and UaBody, as this is how it is in the spec (part 6 5.4.2.16).

I believe we are slightly too conservative in skipping errors in extension objects, which we may be supposed to do, technically. In order to do so better we should create "fallback" types that allow storing raw data in an extension object. This would also make it possible to encode extension objects as other types manually, if you want that for some reason.

I'll be honest and say I don't see a ton of use for these, but completeness is valuable when it comes to encoding/decoding.

Copy link
Contributor

@svanharmelen svanharmelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍🏻

@einarmo einarmo merged commit 851c904 into master Feb 27, 2025
6 checks passed
@einarmo einarmo deleted the cross-decoding branch February 27, 2025 09:47
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.

2 participants