unioffice/schema/soo/dml/chart/CT_LegendEntry.go

120 lines
3.5 KiB
Go
Raw Normal View History

2017-08-28 20:56:18 -05:00
// Copyright 2017 Baliance. All rights reserved.
//
// DO NOT EDIT: generated by gooxml ECMA-376 generator
//
2017-08-28 20:56:18 -05:00
// 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 chart
import (
"encoding/xml"
"baliance.com/gooxml"
2017-08-28 20:56:18 -05:00
)
type CT_LegendEntry struct {
Idx *CT_UnsignedInt
Choice *CT_LegendEntryChoice
ExtLst *CT_ExtensionList
}
func NewCT_LegendEntry() *CT_LegendEntry {
ret := &CT_LegendEntry{}
ret.Idx = NewCT_UnsignedInt()
return ret
}
2017-08-28 20:56:18 -05:00
func (m *CT_LegendEntry) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
2017-09-03 09:29:13 -05:00
seidx := xml.StartElement{Name: xml.Name{Local: "c:idx"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.Idx, seidx)
if m.Choice != nil {
m.Choice.MarshalXML(e, xml.StartElement{})
2017-08-28 20:56:18 -05:00
}
if m.ExtLst != nil {
2017-09-03 09:29:13 -05:00
seextLst := xml.StartElement{Name: xml.Name{Local: "c:extLst"}}
2017-08-28 20:56:18 -05:00
e.EncodeElement(m.ExtLst, seextLst)
}
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
2017-08-28 20:56:18 -05:00
func (m *CT_LegendEntry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
m.Idx = NewCT_UnsignedInt()
lCT_LegendEntry:
for {
tok, err := d.Token()
if err != nil {
return err
}
switch el := tok.(type) {
case xml.StartElement:
switch el.Name {
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/chart", Local: "idx"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/chart", Local: "idx"}:
2017-08-28 20:56:18 -05:00
if err := d.DecodeElement(m.Idx, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/chart", Local: "delete"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/chart", Local: "delete"}:
if m.Choice == nil {
m.Choice = NewCT_LegendEntryChoice()
}
2017-08-28 20:56:18 -05:00
if err := d.DecodeElement(&m.Choice.Delete, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/chart", Local: "txPr"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/chart", Local: "txPr"}:
if m.Choice == nil {
m.Choice = NewCT_LegendEntryChoice()
}
2017-08-28 20:56:18 -05:00
if err := d.DecodeElement(&m.Choice.TxPr, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/chart", Local: "extLst"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/chart", Local: "extLst"}:
2017-08-28 20:56:18 -05:00
m.ExtLst = NewCT_ExtensionList()
if err := d.DecodeElement(m.ExtLst, &el); err != nil {
return err
}
default:
gooxml.Log("skipping unsupported element on CT_LegendEntry %v", el.Name)
2017-08-28 20:56:18 -05:00
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lCT_LegendEntry
case xml.CharData:
}
}
return nil
}
// Validate validates the CT_LegendEntry and its children
2017-08-28 20:56:18 -05:00
func (m *CT_LegendEntry) Validate() error {
return m.ValidateWithPath("CT_LegendEntry")
}
// ValidateWithPath validates the CT_LegendEntry and its children, prefixing error messages with path
2017-08-28 20:56:18 -05:00
func (m *CT_LegendEntry) ValidateWithPath(path string) error {
if err := m.Idx.ValidateWithPath(path + "/Idx"); err != nil {
return err
}
if m.Choice != nil {
if err := m.Choice.ValidateWithPath(path + "/Choice"); err != nil {
return err
}
}
if m.ExtLst != nil {
if err := m.ExtLst.ValidateWithPath(path + "/ExtLst"); err != nil {
return err
}
}
return nil
}