The sample XML in your code doesn't appear to be valid - it doesn't
actually define the namespace that the os namespace prefix refers to.

I am fully aware that encoding/xml has bugs, but I'm not sure
that this is one of them.

On 1 August 2017 at 18:48, Marcin Jurczuk <mjurc...@gmail.com> wrote:
> Your example is returning xml that is wrong from system I'm talking to.
> My SOAP service requires tags in few different namespaces.
> My code returns:
>
>   <os:QUERYResponse>
>
>
> Your code returns:
>
>
> <QUERYResponse xmlns="os">
>
>
> etc.
>
>
> Such syntax is not ok. My Service is returning error. With my syntax - I'm
> getting responses.
>
>
>
> Of course os namespace is declared at the begining of file:
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:os="os.xsd.v1">
>
>
> I looks like go have bug with Unmarshaling tags with namespaces. Bug exists
> at least 2 years, maybe more.
>
>
> W dniu wtorek, 1 sierpnia 2017 19:30:39 UTC+2 użytkownik rog napisał:
>>
>> Namespaces are space-separated from tag names in the struct tags.
>>
>> Changing that seems to make your example work OK:
>>
>> https://play.golang.org/p/GBvhcWLew_
>>
>> From the encoding/xml docs:
>>
>>    If the XMLName field has an associated tag of the form
>>    "name" or "namespace-URL name", the XML element must have
>>    the given name (and, optionally, name space) or else Unmarshal
>>    returns an error.
>>
>>
>> On 1 August 2017 at 15:39, Marcin Jurczuk <mjur...@gmail.com> wrote:
>> > Hi gophers,
>> >
>> > I stuck with something that supposed to be easy - XML decoding. Encoding
>> > works perfeclty.
>> > I'm trying for past two days to find working code for parsing SOAP
>> > message.
>> > I have structures that are encoded correctly but decoding responses
>> > (same
>> > structure, just filled with values) is failing (sic!)
>> >
>> > Here is sample code that encodes struct and then tries decode the same
>> > struct
>> >
>> > https://play.golang.org/p/hE7vcXbymg
>> >
>> >
>> > It seems that Go have a lot of issues with XML jsut small portion:
>> > https://github.com/golang/go/issues/6800 (this one looks like my problem
>> > -
>> > not fixed since 2013 !)
>> > https://github.com/golang/go/issues/9775
>> > https://github.com/golang/go/issues/9519
>> >
>> >
>> > Please help me to diagnose is it my problem or one of Go bugs
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "golang-nuts" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to golang-nuts...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to