mirror of
https://github.com/mappu/miqt.git
synced 2025-01-09 08:51:07 +00:00
35 lines
450 B
Go
35 lines
450 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"encoding/xml"
|
||
|
"fmt"
|
||
|
"io/ioutil"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
in, err := ioutil.ReadFile(`test.ui`)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
var parsed UiFile
|
||
|
err = xml.Unmarshal(in, &parsed)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
ret, err := xml.MarshalIndent(parsed, "", " ")
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
fmt.Println(string(ret))
|
||
|
|
||
|
gosrc, err := generate("main", parsed)
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
|
||
|
fmt.Println(string(gosrc))
|
||
|
}
|