MCPcopy Create free account
hub / github.com/XmirrorSecurity/OpenSCA-cli / Marshal

Function Marshal

opensca/sca/java/xml/marshal.go:80–90  ·  view source on GitHub ↗

Marshal returns the XML encoding of v. Marshal handles an array or slice by marshaling each of the elements. Marshal handles a pointer by marshaling the value it points at or, if the pointer is nil, by writing nothing. Marshal handles an interface value by marshaling the value it contains or, if th

(v any)

Source from the content-addressed store, hash-verified

78//
79// Marshal will return an error if asked to marshal a channel, function, or map.
80func Marshal(v any) ([]byte, error) {
81 var b bytes.Buffer
82 enc := NewEncoder(&b)
83 if err := enc.Encode(v); err != nil {
84 return nil, err
85 }
86 if err := enc.Close(); err != nil {
87 return nil, err
88 }
89 return b.Bytes(), nil
90}
91
92// Marshaler is the interface implemented by objects that can marshal
93// themselves into valid XML elements.

Callers

nothing calls this directly

Calls 3

EncodeMethod · 0.95
CloseMethod · 0.95
NewEncoderFunction · 0.85

Tested by

no test coverage detected