Element returns an etree.Element representing the object in XML form.
()
| 957 | |
| 958 | // Element returns an etree.Element representing the object in XML form. |
| 959 | func (c *Conditions) Element() *etree.Element { |
| 960 | el := etree.NewElement("saml:Conditions") |
| 961 | if !c.NotBefore.IsZero() { |
| 962 | el.CreateAttr("NotBefore", c.NotBefore.Format(timeFormat)) |
| 963 | } |
| 964 | if !c.NotOnOrAfter.IsZero() { |
| 965 | el.CreateAttr("NotOnOrAfter", c.NotOnOrAfter.Format(timeFormat)) |
| 966 | } |
| 967 | for _, v := range c.AudienceRestrictions { |
| 968 | el.AddChild(v.Element()) |
| 969 | } |
| 970 | if c.OneTimeUse != nil { |
| 971 | el.AddChild(c.OneTimeUse.Element()) |
| 972 | } |
| 973 | if c.ProxyRestriction != nil { |
| 974 | el.AddChild(c.ProxyRestriction.Element()) |
| 975 | } |
| 976 | return el |
| 977 | } |
| 978 | |
| 979 | // MarshalXML implements xml.Marshaler |
| 980 | func (c *Conditions) MarshalXML(e *xml.Encoder, start xml.StartElement) error { |