aboutsummaryrefslogtreecommitdiffstats
path: root/timetask/module.go
diff options
context:
space:
mode:
authorTeddy Wing2017-06-04 02:07:50 +0200
committerTeddy Wing2017-06-04 02:07:50 +0200
commit02e4fb5d0d95b8c5c5442ee0a97b960f1296c236 (patch)
tree4cf323694692322036b80d2d921ff966096c6c36 /timetask/module.go
parent055301ca09d57b759b290d897bbb7560460251ca (diff)
parent9b6a6543e351308939bd420243507368b0669e63 (diff)
downloadtimetasker-02e4fb5d0d95b8c5c5442ee0a97b960f1296c236.tar.bz2
Merge branch 'timetasker-daily'
Diffstat (limited to 'timetask/module.go')
-rw-r--r--timetask/module.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/timetask/module.go b/timetask/module.go
new file mode 100644
index 0000000..4dde57a
--- /dev/null
+++ b/timetask/module.go
@@ -0,0 +1,24 @@
+package timetask
+
+import (
+ "encoding/xml"
+)
+
+type Module struct {
+ ID int `xml:"moduleid"`
+ Name string `xml:"modulename"`
+}
+
+type moduleXML struct {
+ Modules []Module `xml:"response>item"`
+}
+
+func ModuleParseXML(xml_str string) ([]Module, error) {
+ modules := moduleXML{}
+ err := xml.Unmarshal([]byte(xml_str), &modules)
+ if err != nil {
+ return nil, err
+ }
+
+ return modules.Modules, nil
+}