I can not parse an XML file of the form:
const xmlstr = `<?xml version="1.0" encoding="UTF-8"?> <users> <test> <user type="admin"> <name>Elliot</name> </user> <user type="reader"> <name>Fraser</name> </user> </test> </users>` type Users struct { XMLName xml.Name `xml:"users"` } type Test struct { Test []Test `xml:"test"` Users []User `xml:"user"` } type User struct { XMLName xml.Name `xml:"user"` Type string `xml:"type,attr"` Name string `xml:"name"`}
Parse succeeds without the <test> : https://play.golang.org/p/KCX_bWOkZE . How to add a structure that would be able to parse XML?