Sha256: fda29b3660672863c6236d94056b52dbc77edce03949df0d47a77ac58c0f3b0b

Contents?: true

Size: 1.35 KB

Versions: 16

Compression:

Stored size: 1.35 KB

Contents

package xml

// writer interface used by the xml encoder to write an encoded xml
// document in a writer.
type writer interface {

	// Write takes in a byte slice and returns number of bytes written and error
	Write(p []byte) (n int, err error)

	// WriteRune takes in a rune and returns number of bytes written and error
	WriteRune(r rune) (n int, err error)

	// WriteString takes in a string and returns number of bytes written and error
	WriteString(s string) (n int, err error)

	// String method returns a string
	String() string

	// Bytes return a byte slice.
	Bytes() []byte
}

// Encoder is an XML encoder that supports construction of XML values
// using methods. The encoder takes in a writer and maintains a scratch buffer.
type Encoder struct {
	w       writer
	scratch *[]byte
}

// NewEncoder returns an XML encoder
func NewEncoder(w writer) *Encoder {
	scratch := make([]byte, 64)

	return &Encoder{w: w, scratch: &scratch}
}

// String returns the string output of the XML encoder
func (e Encoder) String() string {
	return e.w.String()
}

// Bytes returns the []byte slice of the XML encoder
func (e Encoder) Bytes() []byte {
	return e.w.Bytes()
}

// RootElement builds a root element encoding
// It writes it's start element tag. The value should be closed.
func (e Encoder) RootElement(element StartElement) Value {
	return newValue(e.w, e.scratch, element)
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/aws/smithy-go/encoding/xml/encoder.go