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

XML Marshalling Support #9

Closed
weisjohn opened this issue Mar 21, 2018 · 3 comments
Closed

XML Marshalling Support #9

weisjohn opened this issue Mar 21, 2018 · 3 comments

Comments

@weisjohn
Copy link

Hey there, great library. I'm hoping to use it, however, when trying to use xml.Marshal, I get no output. Is there a way to add in support for this? I'm happy to do it if you give me a pointer or two.

@mweibel
Copy link
Collaborator

mweibel commented Mar 24, 2018

Hey @weisjohn,
thanks for the interest.
At the moment there's only json marshalling implemented. To add XML marshalling there are a couple of things which would need to be done.

  1. Your structs would need to be annotated with the xml field tags (see an example here https://golang.org/pkg/encoding/xml/#MarshalIndent)
  2. Most likely the XML tags would need to be read alongside the JSON tags (https://github.com/liip/sheriff/blob/master/sheriff.go#L75)
  3. Another exception might need to be added for XML marshalling here: https://github.com/liip/sheriff/blob/master/sheriff.go#L165

I'm not entirely sure if that's all there is to be done because of the different structure of XML (attributes etc.). sheriff.Marshal returns a map[string]interface{} when passed a struct, which then can be passed to json.Marshal. As XML marshalling is quite a bit different, I'm unsure if that would work for XML marshalling too.
It's worth a try and if you try it out I can help you on the way most likely. Currently don't have the time to do that on my own though.

Let me know if you have further questions!

@mweibel
Copy link
Collaborator

mweibel commented Apr 20, 2018

Any update @weisjohn?

@weisjohn
Copy link
Author

@mweibel nope, sorry, no update. I've moved on from needing this, unfortunately.

@mweibel mweibel closed this as completed Jun 18, 2018
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

No branches or pull requests

2 participants