Hello
bellow is my code. Why in my case xml tage does not work?
also in comment is how to xml should look like
Thank you!
package main
import (
"encoding/xml"
"fmt"
"os"
)
type SmsXML struct {
XMLName xml.Name `xml: "Packet"`
ID int `xml: "Header>ID"`
Content string `xml: "Body>Item>Content"`
PhoneNo string `xml: "Body>Item>Phone_no"`
Content1 string `xml: "Body>Item>Content"`
OriginAddress string `xml: "Body>Item>OriginAddress"`
}
/*
<Packet>
<Header>
<ID>2342353456465</ID>
</Header>
<Body>
<Item>
<Content>SMS</Content>
<Phone_no>+123123213</Phone_no>
<Content>test</Content>
<OriginAddress>sender</OriginAddress>
</Item>
</Body>
</Packet>
*/
func main() {
Send()
}
func Send() {
data := SmsXML{ID: 213, Content: "SMS", PhoneNo: "+12321321331", Content1: "testNumberOne", OriginAddress: "Sender"}
output, err := xml.Marshal(data)
if err != nil {
fmt.Println("xmlError: ", err)
}
os.Stdout.Write(output)
}