unioffice/schema/schemas.openxmlformats.org/drawingml/CT_NonVisualConnectorProperties.go
Todd 9b53a8ea41 schema: check for namespaces when decoding
- check for namespaces when decoding
- merge wordprocessingDrawing into wordprocessingml, this fixes some
  issues with cyclic import paths (XML namespaces don't translate to
  to valid go namespaces due to this)
2017-09-10 10:33:53 -05:00

125 lines
3.7 KiB
Go

// 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 drawingml
import (
"encoding/xml"
"log"
)
type CT_NonVisualConnectorProperties struct {
CxnSpLocks *CT_ConnectorLocking
StCxn *CT_Connection
EndCxn *CT_Connection
ExtLst *CT_OfficeArtExtensionList
}
func NewCT_NonVisualConnectorProperties() *CT_NonVisualConnectorProperties {
ret := &CT_NonVisualConnectorProperties{}
return ret
}
func (m *CT_NonVisualConnectorProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
e.EncodeToken(start)
if m.CxnSpLocks != nil {
secxnSpLocks := xml.StartElement{Name: xml.Name{Local: "a:cxnSpLocks"}}
e.EncodeElement(m.CxnSpLocks, secxnSpLocks)
}
if m.StCxn != nil {
sestCxn := xml.StartElement{Name: xml.Name{Local: "a:stCxn"}}
e.EncodeElement(m.StCxn, sestCxn)
}
if m.EndCxn != nil {
seendCxn := xml.StartElement{Name: xml.Name{Local: "a:endCxn"}}
e.EncodeElement(m.EndCxn, seendCxn)
}
if m.ExtLst != nil {
seextLst := xml.StartElement{Name: xml.Name{Local: "a:extLst"}}
e.EncodeElement(m.ExtLst, seextLst)
}
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
func (m *CT_NonVisualConnectorProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
lCT_NonVisualConnectorProperties:
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/main", Local: "cxnSpLocks"}:
m.CxnSpLocks = NewCT_ConnectorLocking()
if err := d.DecodeElement(m.CxnSpLocks, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "stCxn"}:
m.StCxn = NewCT_Connection()
if err := d.DecodeElement(m.StCxn, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "endCxn"}:
m.EndCxn = NewCT_Connection()
if err := d.DecodeElement(m.EndCxn, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/main", Local: "extLst"}:
m.ExtLst = NewCT_OfficeArtExtensionList()
if err := d.DecodeElement(m.ExtLst, &el); err != nil {
return err
}
default:
log.Printf("skipping unsupported element on CT_NonVisualConnectorProperties %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lCT_NonVisualConnectorProperties
case xml.CharData:
}
}
return nil
}
// Validate validates the CT_NonVisualConnectorProperties and its children
func (m *CT_NonVisualConnectorProperties) Validate() error {
return m.ValidateWithPath("CT_NonVisualConnectorProperties")
}
// ValidateWithPath validates the CT_NonVisualConnectorProperties and its children, prefixing error messages with path
func (m *CT_NonVisualConnectorProperties) ValidateWithPath(path string) error {
if m.CxnSpLocks != nil {
if err := m.CxnSpLocks.ValidateWithPath(path + "/CxnSpLocks"); err != nil {
return err
}
}
if m.StCxn != nil {
if err := m.StCxn.ValidateWithPath(path + "/StCxn"); err != nil {
return err
}
}
if m.EndCxn != nil {
if err := m.EndCxn.ValidateWithPath(path + "/EndCxn"); err != nil {
return err
}
}
if m.ExtLst != nil {
if err := m.ExtLst.ValidateWithPath(path + "/ExtLst"); err != nil {
return err
}
}
return nil
}