implement atom

This commit is contained in:
2022-05-03 17:14:37 -04:00
parent ccbf558fa1
commit 46d173d06c
6 changed files with 109 additions and 45 deletions

View File

@ -29,6 +29,10 @@ type Item struct {
func main() {
fmt.Println("hello go")
foo()
if 1 == 1 {
return
}
data, err := os.ReadFile("/home/balki/projects/tss/w.tmp/ounapuu.xml")
if err != nil {
log.Fatal(err)
@ -93,11 +97,18 @@ func main() {
func foo() {
x := `
<foo>
<bar><blue>slkdfjdslk</blue></bar>
<bar src="hello">
<link href="http://foobar.com">Hello World</link>
<blue>slkdfjdslk</blue>
</bar>
</foo>
`
s := struct {
Bar struct {
Link struct {
Href string `xml:"href,attr"`
} `xml:"link"`
Attr string `xml:"src,attr"`
Content string `xml:",innerxml"`
} `xml:"bar"`
}{}
@ -106,5 +117,5 @@ func foo() {
if err != nil {
log.Fatal(err)
}
fmt.Println(s.Bar.Content)
fmt.Println(s.Bar.Link.Href)
}