Skip to content

Commit

Permalink
spreadsheet: don't allow extra content on Workbook
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaliance committed Oct 5, 2017
1 parent 0805be8 commit 7343e2d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion schema/soo/sml/CT_ConditionalFormatting.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
type CT_ConditionalFormatting struct {
// PivotTable Conditional Formatting
PivotAttr *bool
// Sequence of Refernces
// Sequence of References
SqrefAttr *ST_Sqref
// Conditional Formatting Rule
CfRule []*CT_CfRule
Expand Down
11 changes: 2 additions & 9 deletions schema/soo/sml/CT_Workbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ type CT_Workbook struct {
WebPublishObjects *CT_WebPublishObjects
// Future Feature Data Storage Area
ExtLst *CT_ExtensionList
Extra []gooxml.Any
}

func NewCT_Workbook() *CT_Workbook {
Expand Down Expand Up @@ -152,11 +151,6 @@ func (m *CT_Workbook) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
seextLst := xml.StartElement{Name: xml.Name{Local: "ma:extLst"}}
e.EncodeElement(m.ExtLst, seextLst)
}
for _, any := range m.Extra {
if err := any.MarshalXML(e, xml.StartElement{}); err != nil {
return err
}
}
e.EncodeToken(xml.EndElement{Name: start.Name})
return nil
}
Expand Down Expand Up @@ -274,11 +268,10 @@ lCT_Workbook:
return err
}
default:
any := &gooxml.XSDAny{}
if err := d.DecodeElement(any, &el); err != nil {
gooxml.Log("skipping unsupported element on CT_Workbook %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
m.Extra = append(m.Extra, any)
}
case xml.EndElement:
break lCT_Workbook
Expand Down
5 changes: 2 additions & 3 deletions schema/soo/sml/Workbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,10 @@ lWorkbook:
return err
}
default:
any := &gooxml.XSDAny{}
if err := d.DecodeElement(any, &el); err != nil {
gooxml.Log("skipping unsupported element on Workbook %v", el.Name)
if err := d.Skip(); err != nil {
return err
}
m.Extra = append(m.Extra, any)
}
case xml.EndElement:
break lWorkbook
Expand Down
1 change: 1 addition & 0 deletions xsdany.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var wellKnownSchemas = map[string]string{
"wpi": "http://schemas.microsoft.com/office/word/2010/wordprocessingInk",
"wps": "http://schemas.microsoft.com/office/word/2010/wordprocessingShape",
"xsi": "http://www.w3.org/2001/XMLSchema-instance",
"x15ac": "http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac",
}

var wellKnownSchemasInv = func() map[string]string {
Expand Down

0 comments on commit 7343e2d

Please sign in to comment.