mirror of
https://github.com/golang/go
synced 2024-11-25 18:07:57 -07:00
encoding/xml: use struct literals with named fields
This commit is contained in:
parent
d5764cf484
commit
67dbca9626
@ -582,7 +582,7 @@ func (p *printer) marshalValue(val reflect.Value, finfo *fieldInfo, startTemplat
|
||||
continue
|
||||
}
|
||||
|
||||
name := Name{finfo.xmlns, joinPrefixed(finfo.prefix, finfo.name)}
|
||||
name := Name{Space: finfo.xmlns, Local: joinPrefixed(finfo.prefix, finfo.name)}
|
||||
if err := p.marshalAttr(&start, name, fv); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -592,7 +592,7 @@ func (p *printer) marshalValue(val reflect.Value, finfo *fieldInfo, startTemplat
|
||||
if tinfo.xmlname != nil && start.Name.Space == "" &&
|
||||
tinfo.xmlname.xmlns == "" && tinfo.xmlname.name == "" &&
|
||||
len(p.elements) != 0 && p.elements[len(p.elements)-1].xmlns != "" {
|
||||
start.Attr = append(start.Attr, Attr{Name{"", xmlnsPrefix}, ""})
|
||||
start.Attr = append(start.Attr, Attr{Name{Space: "", Local: xmlnsPrefix}, ""})
|
||||
}
|
||||
|
||||
if err := p.writeStart(&start); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user