Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
catalog href XML marshaling
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Weiss committed Nov 13, 2018
1 parent 88edaec commit 35171ce
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions types/oscal/catalog/href.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ func (h *Href) UnmarshalXMLAttr(attr xml.Attr) error {
func (h *Href) MarshalJSON() ([]byte, error) {
return json.Marshal(h.String())
}

func (h *Href) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
if h.URL != nil {
rawURI := h.URL.String()

return xml.Attr{Name: name, Value: rawURI}, nil
}

return xml.Attr{Name: name}, nil
}

0 comments on commit 35171ce

Please sign in to comment.