Here is the XML structure:
<root xmlns:test="http://test.com/testns"> <test:sub> <title>this is title</title> </test:sub> </root>
It gets unmarshalled with the structures defined below:
type Root struct { XMLName xml.Name `xml:"root"` Sub *Sub } type Sub struct { XMLName xml.Name `xml:"http://test.com/testns sub"` Title string `xml:"title"` }
This is what is taken back:
<root> <sub xmlns="http://test.com/testns"> <title>this is title</title> </sub> </root>
The definition of the root namespace prefix is ββdeleted after the marshal and auxiliary element use the url namespace instead of the prefix. Here is the code
Is there a way that marshal / unmarshal will not alter the xml structure? thanks!
source share