1package filesystem 2 3import ( 4 "encoding/xml" 5 "io/ioutil" 6) 7 8func ReadXMLAsEntity(filePath string, entity interface{}) error { 9 xmlBytes, err := ioutil.ReadFile(filePath) 10 if err != nil { 11 return err 12 } 13 return xml.Unmarshal(xmlBytes, entity) 14} 15