Я пытаюсь проанализировать xml-файл, содержащий элементы с произвольными окончаниями
Пример xml с Array0 и Array1:
<GetPriceChangesForReseller>
<PriceContractArray0 actualtype="PriceContract">
<EndUserPrice>1990,00</EndUserPrice>
</PriceContractArray0>
<PriceContractArray1 actualtype="PriceContract">
<EndUserPrice>2290,00</EndUserPrice>
</PriceContractArray1>
</GetPriceChangesForReseller>
Как мне работать с этим делом?
часть моего кода:
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"os"
)
type GetPriceChangesForReseller struct {
XMLName xml.Name `xml:"GetPriceChangesForReseller"`
GetPriceChangesForReseller []PriceContractArray `xml:"PriceContractArray"`
}
type PriceContractArray struct {
XMLName xml.Name `xml:"PriceContractArray"`
Price string `xml:"Price"`
func main() {
// Open our xmlFile
xmlFile, err := os.Open("GetPriceChangesForReseller.xml")
// if we os.Open returns an error then handle it
if err != nil {
fmt.Println(err)
}
Заранее спасибо!