Different structs for same XML tag with different attributes



Let's say I have this XML:



<something>
<value type="item">
...
</value>
<value type="other">
...
</value>
</something>


Can I somehow extract the value with different attributes to different items on my struct, like:



type Something struct {
Item Item `xml:"value[type=item]"` // metacode
Other Other `xml:"value[type=other]"`
}


Is it possible? What should I use as the xml: attribute?


No comments:

Post a Comment