I've been searching everywhere and can't figure out the solution to this.
I'm trying to get an attribute of a nested xml tag from wikipedia, but have so far been unable to get the nested attribute. I'm specifically trying to get pageid
from the page
tag.
Here's an example of the xml:
<api batchcomplete="">
<query>
<pages>
<page _idx="25039021" pageid="25039021" ns="0" title="Go (programming language)">
<extract xml:space="preserve">
stuff about golang
</extract>
</page>
</pages>
</query>
</api>
Here are the structs that I'm using:
type Page struct {
PageID string `xml:"pageid,attr"`
}
type Extract struct {
Text string `xml:"query>pages>page>extract"`
Page Page `xml:"query>pages>page"`
}
but still extract.page.pageid comes back with nothing. Anything I'm missing/doing wrong?