如何将xml消息解组到结构中

如何将xml消息解组到结构中,xml,go,Xml,Go,如何解码这个xml <?xml version="1.0" encoding="UTF-8"?> <LocationConstraint>oss-cn-hangzhou</LocationConstraint> 但它不起作用。结构的定义暗示以下XML格式与您提供的不匹配: <BucketLocation> <LocationConstraint>oss-cn-hangzhou</LocationConstraint>

如何解码这个xml

<?xml version="1.0" encoding="UTF-8"?>
<LocationConstraint>oss-cn-hangzhou</LocationConstraint>

但它不起作用。

结构的定义暗示以下XML格式与您提供的不匹配:

<BucketLocation>
    <LocationConstraint>oss-cn-hangzhou</LocationConstraint>
</BucketLocation>
<BucketLocation>
    <LocationConstraint>oss-cn-hangzhou</LocationConstraint>
</BucketLocation>
var v string
xml.Unmarshal(xml_content, &v)