unioffice/unioffice.go

123 lines
58 KiB
Go
Raw Normal View History

2020-08-23 14:15:53 +00:00
//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
/*
Package unioffice provides creation, reading, and writing of ECMA 376 Office Open
XML documents, spreadsheets and presentations. It is still early in
development, but is progressing quickly. This library takes a slightly
different approach from others, in that it starts by trying to support all of
the ECMA-376 standard when marshaling/unmarshaling XML documents. From there it
adds wrappers around the ECMA-376 derived types that provide a more convenient
interface.
The raw XML based types reside in the `schema/`` directory. These types are
always accessible from the wrapper types via a `X() method that returns the
raw type. Except for the base documents (document.Document,
spreadsheet.Workbook and presentation.Presentation), the other wrapper types are
value types with non-pointer methods. They exist solely to modify and return
data from one or more XML types.
The packages of interest are github.com/unidoc/unioffice/document,
unidoc/unioffice/spreadsheet and github.com/unidoc/unioffice/presentation.
*/
2022-02-05 13:05:36 +00:00
package unioffice ;import (_d "encoding/xml";_b "errors";_fb "fmt";_fg "github.com/unidoc/unioffice/algo";_c "github.com/unidoc/unioffice/common/logger";_f "log";_ed "reflect";_g "strings";_ea "unicode";);
2021-08-23 20:44:48 +00:00
2022-02-05 13:05:36 +00:00
// AbsoluteFilename returns the full path to a file from the root of the zip
// container. Index is used in some cases for files which there may be more than
// one of (e.g. worksheets/drawings/charts)
func AbsoluteFilename (dt DocType ,typ string ,index int )string {switch typ {case CorePropertiesType :return "\u0064\u006f\u0063\u0050\u0072\u006f\u0070\u0073\u002f\u0063\u006f\u0072e\u002e\u0078\u006d\u006c";case CustomPropertiesType :return "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c";case ExtendedPropertiesType ,ExtendedPropertiesTypeStrict :return "\u0064\u006fc\u0050\u0072\u006fp\u0073\u002f\u0061\u0070\u0070\u002e\u0078\u006d\u006c";case ThumbnailType ,ThumbnailTypeStrict :return "\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067";case CustomXMLType :return _fb .Sprintf ("c\u0075s\u0074\u006f\u006d\u0058\u006d\u006c\u002f\u0069t\u0065\u006d\u0025\u0064.x\u006d\u006c",index );case PresentationPropertiesType :return "\u0070\u0070\u0074\u002f\u0070\u0072\u0065\u0073\u0050\u0072\u006f\u0070s\u002e\u0078\u006d\u006c";case ViewPropertiesType :switch dt {case DocTypePresentation :return "\u0070\u0070\u0074\u002f\u0076\u0069\u0065\u0077\u0050\u0072\u006f\u0070s\u002e\u0078\u006d\u006c";case DocTypeSpreadsheet :return "\u0078\u006c/\u0076\u0069\u0065w\u0050\u0072\u006f\u0070\u0073\u002e\u0078\u006d\u006c";case DocTypeDocument :return "\u0077o\u0072d\u002f\u0076\u0069\u0065\u0077P\u0072\u006fp\u0073\u002e\u0078\u006d\u006c";};case TableStylesType :switch dt {case DocTypePresentation :return "\u0070\u0070\u0074\u002fta\u0062\u006c\u0065\u0053\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c";case DocTypeSpreadsheet :return "\u0078l\u002ft\u0061\u0062\u006c\u0065\u0053t\u0079\u006ce\u0073\u002e\u0078\u006d\u006c";case DocTypeDocument :return "w\u006fr\u0064\u002f\u0074\u0061\u0062\u006c\u0065\u0053t\u0079\u006c\u0065\u0073.x\u006d\u006c";};case HyperLinkType :return "";case OfficeDocumentType ,OfficeDocumentTypeStrict :switch dt {case DocTypeSpreadsheet :return "\u0078l\u002fw\u006f\u0072\u006b\u0062\u006f\u006f\u006b\u002e\u0078\u006d\u006c";case DocTypeDocument :return "\u0077\u006f\u0072\u0064\u002f\u0064\u006f\u0063\u0075\u006d\u0065\u006et\u002e\u0078\u006d\u006c";case DocTypePresentation :return "p\u0070t\u002f\u0070\u0072\u0065\u0073\u0065\u006e\u0074a\u0074\u0069\u006f\u006e.x\u006d\u006c";default:_c .Log .Debug ("\u0075\u006e\u0073u\u0070\u0070\u006f\u0072t\u0065\u0064\u0020\u0074\u0079\u0070\u0065 \u0025\u0073\u0020\u0070\u0061\u0069\u0072\u0020\u0061\u006e\u0064\u0020\u0025\u0076",typ ,dt );};case ThemeType ,ThemeTypeStrict ,ThemeContentType :switch dt {case DocTypeSpreadsheet :return _fb .Sprintf ("x\u006c/\u0074\u0068\u0065\u006d\u0065\u002f\u0074\u0068e\u006d\u0065\u0025\u0064.x\u006d\u006c",index );case DocTypeDocument :return _fb .Sprintf ("\u0077\u006f\u0072\u0064/t\u0068\u0065\u006d\u0065\u002f\u0074\u0068\u0065\u006d\u0065\u0025\u0064\u002e\u0078m\u006c",index );case DocTypePresentation :return _fb .Sprintf ("p\u0070\u0074\u002f\u0074he\u006de\u002f\u0074\u0068\u0065\u006de\u0025\u0064\u002e\u0078\u006d\u006c",index );default:_c .Log .Debug ("\u0075\u006e\u0073u\u0070\u0070\u006f\u0072t\u0065\u0064\u0020\u0074\u0079\u0070\u0065 \u0025\u0073\u0020\u0070\u0061\u0069\u0072\u0020\u0061\u006e\u0064\u0020\u0025\u0076",typ ,dt );};case StylesType ,StylesTypeStrict :switch dt {case DocTypeSpreadsheet :return "\u0078\u006c\u002f\u0073\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c";case DocTypeDocument :return "\u0077o\u0072d\u002f\u0073\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c";case DocTypePresentation :return "\u0070\u0070\u0074\u002f\u0073\u0074\u0079\u006c\u0065s\u002e\u0078\u006d\u006c";default:_c .Log .Debug ("\u0075\u006e\u0073u\u0070\u0070\u006f\u0072t\u0065\u0064\u0020\u0074\u0079\u0070\u0065 \u0025\u0073\u0020\u0070\u0061\u0069\u0072\u0020\u0061\u006e\u0064\u0020\u0025\u0076",typ ,dt );};case ChartType ,ChartTypeStrict ,ChartContentType :switch dt {case DocTypeSpreadsheet :return _fb .Sprintf ("x\u006c\u002f\u0063\u0068ar\u0074s\u002f\u0063\u0068\u0061\u0072t\u0025\u0064\u002e\u0078\u006d\u006c",index );case DocTypeDocument :return _fb .Sprin
2021-01-04 16:11:39 +00:00
2022-02-05 13:05:36 +00:00
// RelativeImageFilename returns an image filename relative to the source file referenced
// from a relationships file. It is identical to RelativeFilename but is used particularly for images
// in order to handle different image formats.
func RelativeImageFilename (dt DocType ,relToTyp ,typ string ,index int ,fileExtension string )string {_ead :=RelativeFilename (dt ,relToTyp ,typ ,index );return _ead [0:len (_ead )-3]+fileExtension ;};
2021-01-04 16:11:39 +00:00
2022-02-05 13:05:36 +00:00
// MarshalXML implements the xml.Marshaler interface.
func (_gdf *XSDAny )MarshalXML (e *_d .Encoder ,start _d .StartElement )error {start .Name =_gdf .XMLName ;start .Attr =_gdf .Attrs ;_bgg :=any {};_bgg .XMLName =_gdf .XMLName ;_bgg .Attrs =_gdf .Attrs ;_bgg .Data =_gdf .Data ;_bgg .Nodes =_bgd (_gdf .Nodes );_dad :=[]string {};_ade :=false ;_gdfg :=nsSet {_bb :map[string ]string {},_edgg :map[string ]string {}};_gdf .collectNS (&_gdfg );_gdfg .applyToNode (&_bgg );for _ ,_baa :=range _gdfg ._fgg {if _ ,_ecf :=_ae [_baa ];_ecf {_dad =append (_dad ,_baa );};_ccb :=_gdfg ._edgg [_baa ];_bgg .Attrs =append (_bgg .Attrs ,_d .Attr {Name :_d .Name {Local :"\u0078\u006d\u006c\u006e\u0073\u003a"+_baa },Value :_ccb });if _baa =="\u006d\u0063"{_ade =true ;};};for _ ,_ab :=range _bgg .Attrs {if _ab .Name .Local =="\u006d\u0063\u003aI\u0067\u006e\u006f\u0072\u0061\u0062\u006c\u0065"{_ade =false ;break ;};};if _ade &&len (_dad )> 0{_bgg .Attrs =append (_bgg .Attrs ,_d .Attr {Name :_d .Name {Local :"\u006d\u0063\u003aI\u0067\u006e\u006f\u0072\u0061\u0062\u006c\u0065"},Value :_g .Join (_dad ,"\u0020")});};return e .Encode (&_bgg );};
2021-06-16 07:10:52 +00:00
2022-02-05 13:05:36 +00:00
// AbsoluteImageFilename returns the full path to an image from the root of the
// zip container.
func AbsoluteImageFilename (dt DocType ,index int ,fileExtension string )string {_ef :=AbsoluteFilename (dt ,ImageType ,index );return _ef [0:len (_ef )-3]+fileExtension ;};var _ccg =func ()map[string ]string {_fc :=map[string ]string {};for _eb ,_fbe :=range _ac {_fc [_fbe ]=_eb ;};return _fc ;}();
2021-09-22 16:41:01 +00:00
2022-02-05 13:05:36 +00:00
// Uint16 returns a copy of v as a pointer.
func Uint16 (v uint16 )*uint16 {_dc :=v ;return &_dc };
2021-07-30 17:03:26 +00:00
2022-02-05 13:05:36 +00:00
// RegisterConstructor registers a constructor function used for unmarshaling
// xsd:any elements.
func RegisterConstructor (ns ,name string ,fn interface{}){_bf [ns +"\u002f"+name ]=fn };
2022-01-15 21:17:38 +00:00
2022-02-05 13:05:36 +00:00
// Uint32 returns a copy of v as a pointer.
func Uint32 (v uint32 )*uint32 {_cgg :=v ;return &_cgg };const _cg =true ;
2021-03-16 20:51:18 +00:00
2022-02-05 13:05:36 +00:00
// RelativeFilename returns a filename relative to the source file referenced
// from a relationships file. Index is used in some cases for files which there
// may be more than one of (e.g. worksheets/drawings/charts)
func RelativeFilename (dt DocType ,relToTyp ,typ string ,index int )string {_gag :=AbsoluteFilename (dt ,typ ,index );if relToTyp ==""{return _gag ;};_a :=AbsoluteFilename (dt ,relToTyp ,index );_da :=_g .Split (_a ,"\u002f");_dd :=_g .Split (_gag ,"\u002f");_de :=0;for _eca :=0;_eca < len (_da );_eca ++{if _da [_eca ]==_dd [_eca ]{_de ++;};if _eca +1==len (_dd ){break ;};};_da =_da [_de :];_dd =_dd [_de :];_gge :=len (_da )-1;if _gge > 0{return _fg .RepeatString ("\u002e\u002e\u002f",_gge )+_g .Join (_dd ,"\u002f");};return _g .Join (_dd ,"\u002f");};
2021-05-31 16:22:30 +00:00
2022-02-05 13:05:36 +00:00
// Int64 returns a copy of v as a pointer.
func Int64 (v int64 )*int64 {_fe :=v ;return &_fe };
2021-07-30 17:03:26 +00:00
2022-02-05 13:05:36 +00:00
// DisableLogging sets the Log function to a no-op so that any log messages are
// silently discarded.
func DisableLogging (){Log =func (string ,...interface{}){}};func (_edb *nsSet )getPrefix (_fda string )string {if _gc ,_fce :=_ccg [_fda ];_fce {if _ ,_cfd :=_edb ._edgg [_gc ];!_cfd {_edb ._edgg [_gc ]=_fda ;_edb ._bb [_fda ]=_gc ;_edb ._fgg =append (_edb ._fgg ,_gc );};return _gc ;};_fda =_g .TrimFunc (_fda ,func (_ebd rune )bool {return !_ea .IsLetter (_ebd )});if _caf ,_bffe :=_edb ._bb [_fda ];_bffe {return _caf ;};_gb :=_g .Split (_fda ,"\u002f");_gb =_g .Split (_gb [len (_gb )-1],"\u003a");_fbf :=_gb [len (_gb )-1];_fca :=0;_ddg :=[]byte {};for {if _fca < len (_fbf ){_ddg =append (_ddg ,_fbf [_fca ]);}else {_ddg =append (_ddg ,'_');};_fca ++;if _ ,_ad :=_edb ._edgg [string (_ddg )];!_ad {_edb ._edgg [string (_ddg )]=_fda ;_edb ._bb [_fda ]=string (_ddg );_edb ._fgg =append (_edb ._fgg ,string (_ddg ));return string (_ddg );};};};
2021-11-10 11:45:21 +00:00
2022-02-05 13:05:36 +00:00
// Float64 returns a copy of v as a pointer.
func Float64 (v float64 )*float64 {_ccd :=v ;return &_ccd };var _ae =map[string ]bool {"\u0077\u0031\u0030":true ,"\u0077\u0031\u0034":true ,"\u0077\u0070\u0031\u0034":true ,"\u0077\u0031\u0035":true ,"\u0078\u0031\u0035a\u0063":true ,"\u0077\u0031\u0036s\u0065":true ,"\u0077\u0031\u0036\u0063\u0069\u0064":true ,"\u0077\u0031\u0036":true ,"\u0077\u0031\u0036\u0063\u0065\u0078":true };var Log =_f .Printf ;
2021-11-10 11:45:21 +00:00
2022-01-15 21:17:38 +00:00
// Int8 returns a copy of v as a pointer.
2022-02-05 13:05:36 +00:00
func Int8 (v int8 )*int8 {_gd :=v ;return &_gd };const MinGoVersion =_cg ;
// XSDAny is used to marshal/unmarshal xsd:any types in the OOXML schema.
type XSDAny struct{XMLName _d .Name ;Attrs []_d .Attr ;Data []byte ;Nodes []*XSDAny ;};func (_bc nsSet )applyToNode (_geg *any ){if _geg .XMLName .Space ==""{return ;};_cga :=_bc .getPrefix (_geg .XMLName .Space );_geg .XMLName .Space ="";_geg .XMLName .Local =_cga +"\u003a"+_geg .XMLName .Local ;_gca :=_geg .Attrs ;_geg .Attrs =nil ;for _ ,_aa :=range _gca {if _aa .Name .Space =="\u0078\u006d\u006cn\u0073"{continue ;};if _aa .Name .Space !=""{_dda :=_bc .getPrefix (_aa .Name .Space );_aa .Name .Space ="";_aa .Name .Local =_dda +"\u003a"+_aa .Name .Local ;};_geg .Attrs =append (_geg .Attrs ,_aa );};for _ ,_ff :=range _geg .Nodes {_bc .applyToNode (_ff );};};func _ba (_gae *any ){for _ ,_fa :=range _gae .Nodes {_ba (_fa );};};
2022-01-15 21:17:38 +00:00
// DocType represents one of the three document types supported (docx/xlsx/pptx)
type DocType byte ;
2022-02-05 13:05:36 +00:00
// Uint64 returns a copy of v as a pointer.
func Uint64 (v uint64 )*uint64 {_ag :=v ;return &_ag };type any struct{XMLName _d .Name ;Attrs []_d .Attr `xml:",any,attr"`;Nodes []*any `xml:",any"`;Data []byte `xml:",chardata"`;};
2021-07-30 17:03:26 +00:00
2022-02-05 13:05:36 +00:00
// Int32 returns a copy of v as a pointer.
func Int32 (v int32 )*int32 {_cgc :=v ;return &_cgc };
2021-05-31 16:22:30 +00:00
2022-02-05 13:05:36 +00:00
// Stringf formats according to a format specifier and returns a pointer to the
// resulting string.
func Stringf (f string ,args ...interface{})*string {_edd :=_fb .Sprintf (f ,args ...);return &_edd };var _bf =map[string ]interface{}{};const (Unknown DocType =iota ;DocTypeSpreadsheet ;DocTypeDocument ;DocTypePresentation ;);
2022-01-15 21:17:38 +00:00
// String returns a copy of v as a pointer.
2022-02-05 13:05:36 +00:00
func String (v string )*string {_cb :=v ;return &_cb };func _gcd (_faf []*any )[]*XSDAny {_bd :=[]*XSDAny {};for _ ,_gcda :=range _faf {_af :=&XSDAny {};_af .XMLName =_gcda .XMLName ;_af .Attrs =_gcda .Attrs ;_af .Data =_gcda .Data ;_af .Nodes =_gcd (_gcda .Nodes );_bd =append (_bd ,_af );};return _bd ;};
2022-01-15 21:17:38 +00:00
2022-02-05 13:05:36 +00:00
// NeedsSpacePreserve returns true if the string has leading or trailing space.
func NeedsSpacePreserve (s string )bool {if len (s )==0{return false ;};switch s [0]{case '\t','\n','\v','\f','\r',' ',0x85,0xA0:return true ;};switch s [len (s )-1]{case '\t','\n','\v','\f','\r',' ',0x85,0xA0:return true ;};return false ;};const (ContentTypesFilename ="\u005b\u0043\u006f\u006ete\u006e\u0074\u005f\u0054\u0079\u0070\u0065\u0073\u005d\u002e\u0078\u006d\u006c";BaseRelsFilename ="_\u0072\u0065\u006c\u0073\u002f\u002e\u0072\u0065\u006c\u0073";);
2021-07-30 17:03:26 +00:00
2022-02-05 13:05:36 +00:00
// Float32 returns a copy of v as a pointer.
func Float32 (v float32 )*float32 {_eaa :=v ;return &_eaa };
2021-07-30 17:03:26 +00:00
2022-02-05 13:05:36 +00:00
// Any is the interface used for marshaling/unmarshaling xsd:any
type Any interface{MarshalXML (_gg *_d .Encoder ,_db _d .StartElement )error ;UnmarshalXML (_edg *_d .Decoder ,_fd _d .StartElement )error ;};var _ac =map[string ]string {"\u0061":"\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065m\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078m\u006cf\u006f\u0072\u006d\u0061\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u0064\u0072\u0061\u0077\u0069\u006e\u0067m\u006c\u002f\u0032\u0030\u0030\u0036\u002f\u006d\u0061\u0069\u006e","\u0064\u0063":"\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0070\u0075\u0072\u006c\u002e\u006f\u0072\u0067/\u0064c\u002f\u0065\u006c\u0065\u006d\u0065\u006e\u0074\u0073\u002f\u0031\u002e\u0031\u002f","\u0064c\u0074\u0065\u0072\u006d\u0073":"\u0068t\u0074\u0070\u003a\u002f/\u0070\u0075\u0072\u006c\u002eo\u0072g\u002fd\u0063\u002f\u0074\u0065\u0072\u006d\u0073/","\u006d\u0063":"\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006e\u0078m\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u006d\u0061\u0072\u006b\u0075\u0070\u002d\u0063\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006ci\u0074\u0079\u002f\u0032\u00300\u0036","\u006d\u006f":"\u0068\u0074\u0074\u0070\u003a\u002f/\u0073\u0063\u0068e\u006d\u0061\u0073.\u006d\u0069\u0063\u0072\u006f\u0073\u006f\u0066\u0074\u002ec\u006f\u006d\u002f\u006f\u0066fi\u0063\u0065\u002f\u006d\u0061\u0063\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u002f\u0032\u0030\u0030\u0038\u002f\u006d\u0061\u0069\u006e","\u0077":"ht\u0074\u0070:\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073.\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u0077\u006f\u0072\u0064\u0070\u0072\u006f\u0063\u0065s\u0073i\u006e\u0067\u006d\u006c\u002f\u0032\u0030\u00306\u002fm\u0061\u0069n","\u0077\u0031\u0030":"\u0075\u0072n\u003a\u0073\u0063\u0068e\u006d\u0061s\u002d\u006d\u0069\u0063\u0072\u006f\u0073\u006ff\u0074\u002d\u0063\u006f\u006d\u003a\u006f\u0066\u0066\u0069\u0063\u0065:\u0077\u006f\u0072\u0064","\u0077\u0031\u0034":"\u0068\u0074t\u0070\u003a\u002f\u002f\u0073c\u0068\u0065\u006d\u0061\u0073.\u006d\u0069\u0063\u0072\u006f\u0073\u006f\u0066\u0074\u002e\u0063\u006f\u006d\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u002f\u0077\u006f\u0072\u0064\u002f\u0032\u0030\u0031\u0030\u002f\u0077\u006f\u0072\u0064\u006d\u006c","\u0077\u0031\u0035":"\u0068\u0074t\u0070\u003a\u002f\u002f\u0073c\u0068\u0065\u006d\u0061\u0073.\u006d\u0069\u0063\u0072\u006f\u0073\u006f\u0066\u0074\u002e\u0063\u006f\u006d\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u002f\u0077\u006f\u0072\u0064\u002f\u0032\u0030\u0031\u0032\u002f\u0077\u006f\u0072\u0064\u006d\u006c","\u0077\u006e\u0065":"\u0068\u0074t\u0070\u003a\u002f\u002f\u0073c\u0068\u0065\u006d\u0061\u0073.\u006d\u0069\u0063\u0072\u006f\u0073\u006f\u0066\u0074\u002e\u0063\u006f\u006d\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u002f\u0077\u006f\u0072\u0064\u002f\u0032\u0030\u0030\u0036\u002f\u0077\u006f\u0072\u0064\u006d\u006c","\u0077\u0070":"\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006f\u0070\u0065\u006ex\u006d\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073\u002e\u006f\u0072\u0067\u002f\u0064\u0072a\u0077\u0069\u006e\u0067\u006d\u006c\u002f\u0032\u0030\u0030\u0036\u002f\u0077\u006f\u0072\u0064\u0070\u0072\u006f\u0063\u0065\u0073\u0073\u0069n\u0067\u0044\u0072\u0061\u0077i\u006e\u0067","\u0077\u0070\u0031\u0034":"\u0068\u0074\u0074\u0070\u003a\u002f/\u0073\u0063\u0068\u0065\u006da\u0073\u002e\u006d\u0069\u0063\u0072o\u0073\u006f\u0066\u0074\u002ec\u006f\u006d\u002f\u006f\u0066\u0066\u0069\u0063\u0065\u002f\u0077\u006fr\u0064\u002f\u0032\u0030\u0031\u0030\u002f\u0077\u006f\u0072\u0064\u0070\u0072\u006f\u0063e\u0073\u0073\u0069\u006e\u0067\u0044\u0072\u0061w\u0069\u006e\u0067","\u0077\u0070\u0063":"\u0068\u0074t\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006d\u0069\u0063\u0072\u006f\u0073\u006ff\u0074\u002e\u0063\u006f\u006d\u002fo\u0066\u0066\u0069\u0063\u0065\u002f\u0077\u006f\u0072\u0
2021-07-30 17:03:26 +00:00
2022-02-05 13:05:36 +00:00
// AddPreserveSpaceAttr adds an xml:space="preserve" attribute to a start
// element if it is required for the string s.
func AddPreserveSpaceAttr (se *_d .StartElement ,s string ){if NeedsSpacePreserve (s ){se .Attr =append (se .Attr ,_d .Attr {Name :_d .Name {Local :"\u0078m\u006c\u003a\u0073\u0070\u0061\u0063e"},Value :"\u0070\u0072\u0065\u0073\u0065\u0072\u0076\u0065"});};};type nsSet struct{_bb map[string ]string ;_edgg map[string ]string ;_fgg []string ;};
2021-11-10 11:45:21 +00:00
2022-02-05 13:05:36 +00:00
// UnmarshalXML implements the xml.Unmarshaler interface.
func (_deb *XSDAny )UnmarshalXML (d *_d .Decoder ,start _d .StartElement )error {_cd :=any {};if _bff :=d .DecodeElement (&_cd ,&start );_bff !=nil {return _bff ;};_ba (&_cd );_deb .XMLName =_cd .XMLName ;_deb .Attrs =_cd .Attrs ;_deb .Data =_cd .Data ;_deb .Nodes =_gcd (_cd .Nodes );return nil ;};
2022-01-15 21:17:38 +00:00
2022-02-05 13:05:36 +00:00
// CreateElement creates an element with the given namespace and name. It is
// used to unmarshal some xsd:any elements to the appropriate concrete type.
func CreateElement (start _d .StartElement )(Any ,error ){_bfb ,_cf :=_bf [start .Name .Space +"\u002f"+start .Name .Local ];if !_cf {_ca :=&XSDAny {};return _ca ,nil ;};_cc :=_ed .ValueOf (_bfb );_ga :=_cc .Call (nil );if len (_ga )!=1{return nil ,_fb .Errorf ("\u0063\u006fn\u0073\u0074\u0072\u0075\u0063t\u006f\u0072\u0020\u0066\u0075n\u0063\u0074\u0069\u006f\u006e\u0020\u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006f\u006e\u0065\u0020\u0076\u0061\u006c\u0075\u0065\u002c\u0020\u0067\u006f\u0074\u0020\u0025\u0064",len (_ga ));};_ec ,_cf :=_ga [0].Interface ().(Any );if !_cf {return nil ,_b .New ("\u0063o\u006e\u0073t\u0072\u0075\u0063\u0074o\u0072\u0020\u0066u\u006e\u0063\u0074\u0069\u006f\u006e\u0020\u0073\u0068ou\u006c\u0064\u0020r\u0065\u0074u\u0072\u006e\u0020\u0061\u006e\u0079 \u0027\u0041n\u0079\u0027");};return _ec ,nil ;};
2022-01-15 21:17:38 +00:00
2022-02-05 13:05:36 +00:00
// Bool returns a copy of v as a pointer.
func Bool (v bool )*bool {_bg :=v ;return &_bg };
2022-01-15 21:17:38 +00:00
2022-02-05 13:05:36 +00:00
// Uint8 returns a copy of v as a pointer.
func Uint8 (v uint8 )*uint8 {_ge :=v ;return &_ge };