forked from unidoc/unioffice
/
WdEG_WrapTypeChoice.go
138 lines (129 loc) · 4.33 KB
/
WdEG_WrapTypeChoice.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// 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"
"baliance.com/gooxml"
)
type WdEG_WrapTypeChoice struct {
WrapNone *WdCT_WrapNone
WrapSquare *WdCT_WrapSquare
WrapTight *WdCT_WrapTight
WrapThrough *WdCT_WrapThrough
WrapTopAndBottom *WdCT_WrapTopBottom
}
func NewWdEG_WrapTypeChoice() *WdEG_WrapTypeChoice {
ret := &WdEG_WrapTypeChoice{}
return ret
}
func (m *WdEG_WrapTypeChoice) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if m.WrapNone != nil {
sewrapNone := xml.StartElement{Name: xml.Name{Local: "wp:wrapNone"}}
e.EncodeElement(m.WrapNone, sewrapNone)
}
if m.WrapSquare != nil {
sewrapSquare := xml.StartElement{Name: xml.Name{Local: "wp:wrapSquare"}}
e.EncodeElement(m.WrapSquare, sewrapSquare)
}
if m.WrapTight != nil {
sewrapTight := xml.StartElement{Name: xml.Name{Local: "wp:wrapTight"}}
e.EncodeElement(m.WrapTight, sewrapTight)
}
if m.WrapThrough != nil {
sewrapThrough := xml.StartElement{Name: xml.Name{Local: "wp:wrapThrough"}}
e.EncodeElement(m.WrapThrough, sewrapThrough)
}
if m.WrapTopAndBottom != nil {
sewrapTopAndBottom := xml.StartElement{Name: xml.Name{Local: "wp:wrapTopAndBottom"}}
e.EncodeElement(m.WrapTopAndBottom, sewrapTopAndBottom)
}
return nil
}
func (m *WdEG_WrapTypeChoice) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
lWdEG_WrapTypeChoice:
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: "wrapNone"}:
m.WrapNone = NewWdCT_WrapNone()
if err := d.DecodeElement(m.WrapNone, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "wrapSquare"}:
m.WrapSquare = NewWdCT_WrapSquare()
if err := d.DecodeElement(m.WrapSquare, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "wrapTight"}:
m.WrapTight = NewWdCT_WrapTight()
if err := d.DecodeElement(m.WrapTight, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "wrapThrough"}:
m.WrapThrough = NewWdCT_WrapThrough()
if err := d.DecodeElement(m.WrapThrough, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "wrapTopAndBottom"}:
m.WrapTopAndBottom = NewWdCT_WrapTopBottom()
if err := d.DecodeElement(m.WrapTopAndBottom, &el); err != nil {
return err
}
default:
gooxml.Log("skipping unsupported element on WdEG_WrapTypeChoice %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lWdEG_WrapTypeChoice
case xml.CharData:
}
}
return nil
}
// Validate validates the WdEG_WrapTypeChoice and its children
func (m *WdEG_WrapTypeChoice) Validate() error {
return m.ValidateWithPath("WdEG_WrapTypeChoice")
}
// ValidateWithPath validates the WdEG_WrapTypeChoice and its children, prefixing error messages with path
func (m *WdEG_WrapTypeChoice) ValidateWithPath(path string) error {
if m.WrapNone != nil {
if err := m.WrapNone.ValidateWithPath(path + "/WrapNone"); err != nil {
return err
}
}
if m.WrapSquare != nil {
if err := m.WrapSquare.ValidateWithPath(path + "/WrapSquare"); err != nil {
return err
}
}
if m.WrapTight != nil {
if err := m.WrapTight.ValidateWithPath(path + "/WrapTight"); err != nil {
return err
}
}
if m.WrapThrough != nil {
if err := m.WrapThrough.ValidateWithPath(path + "/WrapThrough"); err != nil {
return err
}
}
if m.WrapTopAndBottom != nil {
if err := m.WrapTopAndBottom.ValidateWithPath(path + "/WrapTopAndBottom"); err != nil {
return err
}
}
return nil
}