Untitled

mail@pastecode.io avatar
unknown
golang
3 years ago
415 B
7
Indexable
Never
package main

import (
	"encoding/xml"
	"fmt"
	"io/ioutil"
	"os"
)

type Response struct {
	XMLName        xml.Name `xml:"string"`
	ResponseString string   `xml:",chardata"`
}

func main() {
	xmlFile, err := os.Open("response.xml")
	if err != nil {
		fmt.Println(err)
	}
	defer xmlFile.Close()
	byteValue, _ := ioutil.ReadAll(xmlFile)
	var r Response
	xml.Unmarshal(byteValue, &r)
	fmt.Println(r.ResponseString)

}