74 lines
1.7 KiB
Go
Raw Normal View History

2017-08-28 20:56:18 -05:00
// Copyright 2017 Baliance. All rights reserved.
//
// 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 wordprocessingml
import (
"encoding/xml"
2017-08-29 16:55:03 -05:00
"baliance.com/gooxml"
2017-08-28 20:56:18 -05:00
)
type CT_ShapeDefaults struct {
2017-08-29 16:55:03 -05:00
Any []gooxml.Any
2017-08-28 20:56:18 -05:00
}
func NewCT_ShapeDefaults() *CT_ShapeDefaults {
ret := &CT_ShapeDefaults{}
return ret
}
2017-08-28 20:56:18 -05:00
func (m *CT_ShapeDefaults) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
2017-08-29 16:55:03 -05:00
if m.Any != nil {
for _, c := range m.Any {
c.MarshalXML(e, start)
}
}
2017-08-28 20:56:18 -05:00
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
2017-08-28 20:56:18 -05:00
func (m *CT_ShapeDefaults) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
2017-08-29 16:55:03 -05:00
lCT_ShapeDefaults:
2017-08-28 20:56:18 -05:00
for {
tok, err := d.Token()
if err != nil {
2017-08-29 16:55:03 -05:00
return err
2017-08-28 20:56:18 -05:00
}
2017-08-29 16:55:03 -05:00
switch el := tok.(type) {
case xml.StartElement:
switch el.Name.Local {
default:
if anyEl, err := gooxml.CreateElement(el); err != nil {
return err
} else {
if err := d.DecodeElement(anyEl, &el); err != nil {
return err
}
m.Any = append(m.Any, anyEl)
}
}
case xml.EndElement:
break lCT_ShapeDefaults
case xml.CharData:
2017-08-28 20:56:18 -05:00
}
}
return nil
}
// Validate validates the CT_ShapeDefaults and its children
2017-08-28 20:56:18 -05:00
func (m *CT_ShapeDefaults) Validate() error {
return m.ValidateWithPath("CT_ShapeDefaults")
}
// ValidateWithPath validates the CT_ShapeDefaults and its children, prefixing error messages with path
2017-08-28 20:56:18 -05:00
func (m *CT_ShapeDefaults) ValidateWithPath(path string) error {
return nil
}