1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-05 07:40:24 +08:00
Files
go-docx/structlink.go
2023-02-15 16:08:28 +08:00

35 lines
525 B
Go

package docxlib
import (
"encoding/xml"
"io"
)
// Hyperlink element contains links
type Hyperlink struct {
XMLName xml.Name `xml:"w:hyperlink,omitempty"`
ID string `xml:"r:id,attr"`
Run Run
}
func (r *Hyperlink) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
for {
t, err := d.Token()
if err == io.EOF {
break
}
switch tt := t.(type) {
case xml.StartElement:
if tt.Name.Local == "r" {
d.DecodeElement(&r.Run, &start)
} else {
continue
}
}
}
return nil
}