summaryrefslogtreecommitdiffhomepage
path: root/drive/driveimpl/shared/xml.go
blob: 79fd0885dd500436a5065cb6d698d7af44113eba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause

package shared

import (
	"bytes"
	"encoding/xml"
)

// EscapeForXML escapes the given string for use in XML text.
func EscapeForXML(s string) string {
	result := bytes.NewBuffer(nil)
	xml.Escape(result, []byte(s))
	return result.String()
}