Open fantasist opened 9 years ago
This issue seems to be a duplicate of https://github.com/golang/go/issues/6800
Dup of #6800.
See #11841.
CL https://golang.org/cl/12570 mentions this issue.
Blocked on #13400.
The provided example is invalid XML as the prefix a
for element <a:B>
is not bound. The prefix needs a declaration like xmlns:a="...". The reported error : expected element type <a:B> but have <B>
points to the correct element.
@fantasist
Here's an unmarshal wrapper that allows namespace prefix
The provided case written as a test passes with the suggested CL of #9519 .
Example: type A struct { XMLName xml.Name</a:B>", as expected.
However if we run
a := A{}
xml.Unmarshal([]byte("</a:B>"), &a)
xml:"a:B"
} Struct A is marshaled to "It results in an error saying "unexpected error: expected element type but have "