Original post

so lets say for example I have this xml:

<container>
     <children>
          <child type="M">1</child>
          <child type="C">2</child>
          <child type="W">3</child>
     </children>
</container>

how can I say I want the child that contains type C, If i have a struct like this:

type Container struct {
     Container Child `xml:"container>children"`
}
type Child struct {
     Type string `cml:"type,attr"`
     Child int `xml:"child"`
}

me having this ^ will return the first child. But I want the 2nd or 3rd child. Is there a way to write this without iterating through the xml?

Thank you!