1 // Copyright 2016 Charles Banning. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file 4 5 // strict.go actually addresses setting xml.Decoder attribute 6 // values. This'll let you parse non-standard XML. 7 8 package mxj 9 10 import ( 11 "encoding/xml" 12 ) 13 14 // CustomDecoder can be used to specify xml.Decoder attribute 15 // values, e.g., Strict:false, to be used. By default CustomDecoder 16 // is nil. If CustomeDecoder != nil, then mxj.XmlCharsetReader variable is 17 // ignored and must be set as part of the CustomDecoder value, if needed. 18 // Usage: 19 // mxj.CustomDecoder = &xml.Decoder{Strict:false} 20 var CustomDecoder *xml.Decoder 21 22 // useCustomDecoder copy over public attributes from customDecoder 23 func useCustomDecoder(d *xml.Decoder) { 24 d.Strict = CustomDecoder.Strict 25 d.AutoClose = CustomDecoder.AutoClose 26 d.Entity = CustomDecoder.Entity 27 d.CharsetReader = CustomDecoder.CharsetReader 28 d.DefaultSpace = CustomDecoder.DefaultSpace 29 } 30 31