Documentation ¶
Index ¶
Constants ¶
const Name = "xml"
Name is type name.
Variables ¶
This section is empty.
Functions ¶
func WithDecoderOption ¶
func WithDecoderOption(unmarshaler encoding.Unmarshaler, opt ...DecoderOption) encoding.Unmarshaler
WithDecoderOption returns a proxy of encoding.Unmarshaler. It wraps DecoderOption into context.Context, and then calls Unmarshal method of the underlying encoding.Unmarshaler with the new context.Context.
func WithEncoderOption ¶
func WithEncoderOption(marshaler encoding.Marshaler, opt ...EncoderOption) encoding.Marshaler
WithEncoderOption returns a proxy of encoding.Marshaler. It wraps EncoderOption into context.Context, and then calls Marshal method of the underlying encoding.Marshaler with the new context.Context.
Types ¶
type CharsetReader ¶
CharsetReader is function for xml.Decoder.CharsetReader.
func AsUtf8CharsetReader ¶
func AsUtf8CharsetReader() CharsetReader
AsUtf8CharsetReader returns a CharsetReader which treat the input content as UTF-8 encoded, no matter what charset the input claims.
func IanaTransformCharsetReader ¶
func IanaTransformCharsetReader() CharsetReader
IanaTransformCharsetReader return a CharsetReader which treat the input content as encoded as what charset it claims. The CharsetReader will look up supported encoding according to the charset name. If no charset found or the encoding is not supported by runtime platform, The CharsetReader returns a non-nil error. The CharsetReader decode the input content by the encoding found.
type DecoderOption ¶
DecoderOption is a function which modifies a *xml.Decoder.
func WithCharsetReader ¶
func WithCharsetReader(reader CharsetReader) DecoderOption
WithCharsetReader returns a DecoderOption which modifies decoder's CharsetReader.
type EncoderOption ¶
EncoderOption is a function which modifies a *xml.Encoder
func WithEncodingProcInst ¶
func WithEncodingProcInst(name string) EncoderOption
WithEncodingProcInst returns a EncoderOption which writes a processing instruction. The content of processing instruction will be `<?xml version="1.0" encoding="#{charset-name}"?>`. NOTE: You should provide this option at most once. Only the first option this function produced will work.
func WithIndent ¶
func WithIndent(prefix string, indent string) EncoderOption
WithIndent returns a EncoderOption which modifies the indent the encoder outputs.