-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WdEG_WrapType.go
93 lines (85 loc) · 3.04 KB
/
WdEG_WrapType.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
package wml
import (
"encoding/xml"
"go.devnw.com/ooxml"
)
type WdEG_WrapType struct {
Choice *WdEG_WrapTypeChoice
}
func NewWdEG_WrapType() *WdEG_WrapType {
ret := &WdEG_WrapType{}
return ret
}
func (m *WdEG_WrapType) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if m.Choice != nil {
m.Choice.MarshalXML(e, xml.StartElement{})
}
return nil
}
func (m *WdEG_WrapType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// initialize to default
lWdEG_WrapType:
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"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing", Local: "wrapNone"}:
m.Choice = NewWdEG_WrapTypeChoice()
if err := d.DecodeElement(&m.Choice.WrapNone, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "wrapSquare"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing", Local: "wrapSquare"}:
m.Choice = NewWdEG_WrapTypeChoice()
if err := d.DecodeElement(&m.Choice.WrapSquare, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "wrapTight"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing", Local: "wrapTight"}:
m.Choice = NewWdEG_WrapTypeChoice()
if err := d.DecodeElement(&m.Choice.WrapTight, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "wrapThrough"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing", Local: "wrapThrough"}:
m.Choice = NewWdEG_WrapTypeChoice()
if err := d.DecodeElement(&m.Choice.WrapThrough, &el); err != nil {
return err
}
case xml.Name{Space: "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", Local: "wrapTopAndBottom"},
xml.Name{Space: "http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing", Local: "wrapTopAndBottom"}:
m.Choice = NewWdEG_WrapTypeChoice()
if err := d.DecodeElement(&m.Choice.WrapTopAndBottom, &el); err != nil {
return err
}
default:
office.Log("skipping unsupported element on WdEG_WrapType %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
}
case xml.EndElement:
break lWdEG_WrapType
case xml.CharData:
}
}
return nil
}
// Validate validates the WdEG_WrapType and its children
func (m *WdEG_WrapType) Validate() error {
return m.ValidateWithPath("WdEG_WrapType")
}
// ValidateWithPath validates the WdEG_WrapType and its children, prefixing error messages with path
func (m *WdEG_WrapType) ValidateWithPath(path string) error {
if m.Choice != nil {
if err := m.Choice.ValidateWithPath(path + "/Choice"); err != nil {
return err
}
}
return nil
}