spreadsheet: don't allow extra content on Workbook

Fixes #107
This commit is contained in:
Todd 2017-10-05 08:12:39 -04:00
parent 0805be88ba
commit 7343e2d31f
4 changed files with 6 additions and 13 deletions

View File

@ -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

View File

@ -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 {
@ -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
}
@ -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

View File

@ -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

View File

@ -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 {