xml解组后获取根结构

I'm reading an xml file and automatically unmarshalling it.

I defined the data structure as follows:

type oDoc struct {
    Body      oBody      `xml:"body"`
    AutoStyle oAutoStyle `xml:"automatic-styles"`
}
type oBody struct {
    Spreadsheet oSpread `xml:"spreadsheet"`
}
type oSpread struct {
    Tables []oTable `xml:"table"`
}
type oTable struct {
    Name string `xml:"name,attr"`
    Rows []oRow `xml:"table-row"`
}
type oRow struct {
    Cells []oCell `xml:"table-cell"`
    Style string  `xml:"style-name,attr"`
}

There is more further down but it doesn't matter for this example.

From an oRow object, I need to access the root oDoc object.

Is this possible? I've seen several examples using interfaces but this seems to require me manually adding each element to set the respective parent. I'm not sure I can do this as the unmarshalling is automatic.

Edit: Example of what I'm trying to achieve. oDoc splits into oTables and oStyles (styles not added for brevity). Each oRow has a style Name corresponding to an oStyle object. I want to be able to create a method that can do

rowOject.getStyleObject()

As per gonutz's suggestion, I could do something like

docObj.getRow(specificRow).getStyle(docObj) 

and use that docObj to drilldown to the style I want but this like it is bad form. If it's the only/best solution, I'll go for it but seems like there should be a better way.

Any suggestions?

Just add back-references to your document if you really need them. Here are the needed changes to the code:

type oRow struct {
    Cells []oCell `xml:"table-cell"`
    Style string  `xml:"style-name,attr"`
    doc   *oDoc // this will not affect the xml parsing
}

func main() {
    var doc oDoc
    // load the oDoc...
    // then add the back-references
    for t := range doc.Body.Spreadsheet.Tables {
        table := &doc.Body.Spreadsheet.Tables[t]
        for i := range table.Rows {
            table.Rows[i].doc = &doc
        }
    }
}