Skip to content

Commit

Permalink
Fix marshalling/unmarshalling of command children
Browse files Browse the repository at this point in the history
  • Loading branch information
bodqhrohro committed Jan 31, 2024
1 parent 5f99e1c commit 3806943
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions stanza/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ type CommandElement interface {
}

type Actions struct {
XMLName xml.Name `xml:"actions"`

Prev *struct{} `xml:"prev,omitempty"`
Next *struct{} `xml:"next,omitempty"`
Complete *struct{} `xml:"complete,omitempty"`
Expand All @@ -68,6 +70,8 @@ func (a *Actions) Ref() string {
}

type Note struct {
XMLName xml.Name `xml:"note"`

Text string `xml:",cdata"`
Type string `xml:"type,attr,omitempty"`
}
Expand Down Expand Up @@ -117,11 +121,11 @@ func (c *Command) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var err error
switch tt.Name.Local {

case "affiliations":
case "actions":
a := Actions{}
err = d.DecodeElement(&a, &tt)
c.CommandElement = &a
case "configure":
case "note":
nt := Note{}
err = d.DecodeElement(&nt, &tt)
c.CommandElement = &nt
Expand Down

0 comments on commit 3806943

Please sign in to comment.