Having trouble parallelizing this xml
Trying to understand how to decouple XML in Go. Read some examples and stackoverflow questions. What I want is a snippet with all the fixes installed on the system. I can't even get patches to unleash, bugs, just an empty piece. Probably doing something mostly wrong, thanks in advance for any suggestions.
<probe version="1.3" date="2012-03-26:17:10">
<properties>
</properties>
<patches group="server">
<file name="5002012-02-09CR00000server.jar"/>
<file name="5002012-02-17CR00001server.jar"/>
</patches>
<patches group="client">
<file name="5002012-02-09CR00000client.jar"/>
<file name="5002012-02-17CR00001client.jar"/>
</patches>
</probe>
type Patch struct {
group string `xml:"group,attr"`
}
type Probe struct {
XMLName xml.Name `xml"probe"`
Patches []Patch `xml:"patches"`
}
source to share
The problem I believe is the package xml
not filling in the outstanding fields. The xml documentation says:
Since Unmarshal uses the reflection package, it can only assign exported fields (upper case).
All you have to do is change group
to group
:
type Patch struct { Group string `xml:"group,attr"` }
You have a working example here: http://play.golang.org/p/koSzZr-Bdn
source to share