title: How to parser huge xml in GO ignoring nested elements?
body: <p>I have this XML, for example:  </p>
  
  <pre><code>     &lt;Report&gt;
          ...
          &lt;ElementOne Blah="bleh"&gt;
              &lt;IgnoreElement&gt;
                  &lt;Foo&gt;
                     ...
                  &lt;/Foo&gt;
              &lt;/IgnoreElement&gt;
  
              &lt;WantThisElement&gt;
                  &lt;Bar Baz="test"&gt;
                     ...
                  &lt;/Bar&gt;
                  &lt;Bar Baz="test2"&gt;
                     ...
                  &lt;/Bar&gt;
              &lt;/WantThisElement&gt;
          &lt;/ElementOne&gt;
          ...
      &lt;/Report&gt;
  </code></pre>
  
  <p>And I'm parsing this with encode/xml:</p>
  
  <pre><code>    ... 
      decoder := xml.NewDecoder(resp.Body)
      Mystruct := MyStruct{}
      for {
      t, _ := decoder.Token()
  
      if t == nil {
          break
      }
      switch se := t.(type) {
      case xml.StartElement:
          if se.Name.Local == "ElementOne" {
              decoder.DecodeElement(&amp;Mystruct, &amp;se)
          }
      }
      ...
  
  
  
     type MyStruct struct{
          Blah string
          Bar []Bar
     }
     type Bar struct{
          Baz string
          ...
     }
  </code></pre>
  
  <p>I'm not sure if it is the best way to do it and I don't know if the decoder.DecodeElement(...) ignoring the nested elements that I don't want to parse. I want to increase perfomance with low memory cost. What the best way to parser these huge XML files?</p>