E
E
exitialis2019-06-27 18:00:56
go
exitialis, 2019-06-27 18:00:56

How to deal with xml prefixes in GO?

Good afternoon. By a difficult fate, I am forced to implement the xml protocol. And I ran into such an unpleasant problem: after describing all the structures, they perfectly generate xml, but they cannot do their own generated xml Unmarshal, they give an error:

expected element type <ns:invoicing> but have <invoicing>
I found that this is a language bug , but perhaps there is some simple life-hack to get out of this situation? Playground

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Tsvetkov, 2019-06-28
@yellow79

maybe there is some simple trick

This life hack is just described in the link to the bug. You should have 2 structures, one such as now, for coding, and the other exactly the same, but in the description of xml tags, the separator is not a colon, but a space for decoding.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question