XML编码:混合属性和元素

I have a question regarding marshalling Go XML: I get this:

<root abc="">
  <element></element>
</root>

but I'd like this:

<root>
  <element abc=""></element>
</root>

(the attribute abc is at the child element).

Is this (easily) possible?

My code:

package main

import (
    "encoding/xml"
    "fmt"
    "os"
)

type foo struct {
    XMLName xml.Name `xml:"root"`
    Abc     string   `xml:"abc,attr"`
    Element string   `xml:"element"`
}

func main() {
    f := foo{}
    a, err := xml.MarshalIndent(f, "", "  ")
    if err != nil {
        fmt.Println(err)
        os.Exit(0)
    }
    fmt.Println(string(a))
}

You may define your struct like:

type foo struct {
    XMLName xml.Name `xml:"root"`
    Element struct{
        xml.Name `xml:"element"`
        Abc     string   `xml:"abc,attr"`
    }  
}