From 958a3605f119b1f17c819cc8f9b159ca81d69ac3 Mon Sep 17 00:00:00 2001 From: CornierKhan1 Date: Sun, 26 Aug 2018 17:00:38 +1000 Subject: [PATCH] not working, but its something --- main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index e41dcd3..fe86db1 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,9 @@ package main import ( + "encoding/xml" "fmt" + "io/ioutil" "net/http" ) @@ -23,9 +25,13 @@ type Check struct { } func main() { - + file, err := ioutil.ReadFile("SOAP-WSC/ECS/checkDeviceStatus.xml") // ChRes is a variable that's in the form of JSON. This organises all the data into sub-variables like ChRes.CDS. // This is probably my favourite thing in GoLang to be honest. + if err != nil { + panic(err) + return + } ChRes := Check{ CDS: "", LET: "", @@ -36,6 +42,11 @@ func main() { REG: "", UNR: "", } + err = xml.Unmarshal(file, &ChRes) + if err != nil { + fmt.Printf("error: %v", err) + return + } fmt.Println(ChRes) // http.ListenAndServe starts a HTTP server, which is important to take note of as we will be using this to deliver the SOAP.