// Copyright 2017 Baliance. All rights reserved. // // DO NOT EDIT: generated by gooxml ECMA-376 generator // // Use of this source code is governed by the terms of the Affero GNU General // Public License version 3.0 as published by the Free Software Foundation and // appearing in the file LICENSE included in the packaging of this file. A // commercial license can be purchased by contacting sales@baliance.com. package vml import ( "encoding/xml" "log" ) type Background struct { CT_Background } func NewBackground() *Background { ret := &Background{} ret.CT_Background = *NewCT_Background() return ret } func (m *Background) MarshalXML(e *xml.Encoder, start xml.StartElement) error { start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns"}, Value: "urn:schemas-microsoft-com:vml"}) start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:o"}, Value: "urn:schemas-microsoft-com:office:office"}) start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:r"}, Value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"}) start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:s"}, Value: "http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"}) start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:ur"}, Value: "urn:schemas-microsoft-com:office:powerpoint"}) start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:urn"}, Value: "urn:schemas-microsoft-com:office:word"}) start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:v"}, Value: "urn:schemas-microsoft-com:vml"}) start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:w"}, Value: "http://schemas.openxmlformats.org/wordprocessingml/2006/main"}) start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:x"}, Value: "urn:schemas-microsoft-com:office:excel"}) start.Attr = append(start.Attr, xml.Attr{Name: xml.Name{Local: "xmlns:xml"}, Value: "http://www.w3.org/XML/1998/namespace"}) start.Name.Local = "v:background" return m.CT_Background.MarshalXML(e, start) } func (m *Background) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { // initialize to default m.CT_Background = *NewCT_Background() for _, attr := range start.Attr { if attr.Name.Local == "bwmode" { m.BwmodeAttr.UnmarshalXMLAttr(attr) } if attr.Name.Local == "bwpure" { m.BwpureAttr.UnmarshalXMLAttr(attr) } if attr.Name.Local == "bwnormal" { m.BwnormalAttr.UnmarshalXMLAttr(attr) } if attr.Name.Local == "targetscreensize" { m.TargetscreensizeAttr.UnmarshalXMLAttr(attr) } if attr.Name.Local == "id" { parsed, err := attr.Value, error(nil) if err != nil { return err } m.IdAttr = &parsed } if attr.Name.Local == "filled" { m.FilledAttr.UnmarshalXMLAttr(attr) } if attr.Name.Local == "fillcolor" { parsed, err := attr.Value, error(nil) if err != nil { return err } m.FillcolorAttr = &parsed } } lBackground: for { tok, err := d.Token() if err != nil { return err } switch el := tok.(type) { case xml.StartElement: switch el.Name { case xml.Name{Space: "urn:schemas-microsoft-com:vml", Local: "fill"}: m.Fill = NewFill() if err := d.DecodeElement(m.Fill, &el); err != nil { return err } default: log.Printf("skipping unsupported element on Background %v", el.Name) if err := d.Skip(); err != nil { return err } } case xml.EndElement: break lBackground case xml.CharData: } } return nil } // Validate validates the Background and its children func (m *Background) Validate() error { return m.ValidateWithPath("Background") } // ValidateWithPath validates the Background and its children, prefixing error messages with path func (m *Background) ValidateWithPath(path string) error { if err := m.CT_Background.ValidateWithPath(path); err != nil { return err } return nil }