Skip to content

Automatically encode struct requests with encoding/xml#1

Open
pmh1wheel wants to merge 4 commits into
masterfrom
allow-std-xml-encoding
Open

Automatically encode struct requests with encoding/xml#1
pmh1wheel wants to merge 4 commits into
masterfrom
allow-std-xml-encoding

Conversation

@pmh1wheel
Copy link
Copy Markdown
Owner

This leaves the struct handling alone in recursiveEncode, which is designed to deal with individual xml.Tokens.

Instead, we just use xml.Encode for top-level structs instead of diving into recursiveEncode, and leave the formatting up to the struct tags

…marshaling

Currently requires an explicit Request.UseXMLEncoder flag, but can probably
automatically detect an XMLName field on the request object without breaking
compatibility with requests which might trigger the Struct branch in
recursiveEncode

It's also a slightly uncomfortable mix of creating tokens for later encoding
alongside encoding things directly, but the current interfaces make that hard
to avoid

Tests also still need a bit of work
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.

1 participant