// 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 wml import ( "encoding/xml" "log" "baliance.com/gooxml/schema/soo/dml" ) type WdCT_WordprocessingShapeChoice struct { CNvSpPr *dml.CT_NonVisualDrawingShapeProps CNvCnPr *dml.CT_NonVisualConnectorProperties } func NewWdCT_WordprocessingShapeChoice() *WdCT_WordprocessingShapeChoice { ret := &WdCT_WordprocessingShapeChoice{} return ret } func (m *WdCT_WordprocessingShapeChoice) MarshalXML(e *xml.Encoder, start xml.StartElement) error { if m.CNvSpPr != nil { secNvSpPr := xml.StartElement{Name: xml.Name{Local: "wp:cNvSpPr"}} e.EncodeElement(m.CNvSpPr, secNvSpPr) } if m.CNvCnPr != nil { secNvCnPr := xml.StartElement{Name: xml.Name{Local: "wp:cNvCnPr"}} e.EncodeElement(m.CNvCnPr, secNvCnPr) } return nil } func (m *WdCT_WordprocessingShapeChoice) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { // initialize to default lWdCT_WordprocessingShapeChoice: 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/wordprocessingDrawing", Local: "cNvSpPr"}: m.CNvSpPr = dml.NewCT_NonVisualDrawingShapeProps() if err := d.DecodeElement(m.CNvSpPr, &el); err != nil { return err } case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "cNvCnPr"}: m.CNvCnPr = dml.NewCT_NonVisualConnectorProperties() if err := d.DecodeElement(m.CNvCnPr, &el); err != nil { return err } default: log.Printf("skipping unsupported element on WdCT_WordprocessingShapeChoice %v", el.Name) if err := d.Skip(); err != nil { return err } } case xml.EndElement: break lWdCT_WordprocessingShapeChoice case xml.CharData: } } return nil } // Validate validates the WdCT_WordprocessingShapeChoice and its children func (m *WdCT_WordprocessingShapeChoice) Validate() error { return m.ValidateWithPath("WdCT_WordprocessingShapeChoice") } // ValidateWithPath validates the WdCT_WordprocessingShapeChoice and its children, prefixing error messages with path func (m *WdCT_WordprocessingShapeChoice) ValidateWithPath(path string) error { if m.CNvSpPr != nil { if err := m.CNvSpPr.ValidateWithPath(path + "/CNvSpPr"); err != nil { return err } } if m.CNvCnPr != nil { if err := m.CNvCnPr.ValidateWithPath(path + "/CNvCnPr"); err != nil { return err } } return nil }