xmlEscape replaces XML/HTML special characters with their entity equivalents so that generated XML config files are well-formed even when values contain characters like &, <, >, " or '.
(s string)
| 1632 | // so that generated XML config files are well-formed even when values contain |
| 1633 | // characters like &, <, >, " or '. |
| 1634 | func xmlEscape(s string) string { |
| 1635 | replacer := strings.NewReplacer( |
| 1636 | "&", "&", |
| 1637 | "<", "<", |
| 1638 | ">", ">", |
| 1639 | `"`, """, |
| 1640 | "'", "'", |
| 1641 | ) |
| 1642 | return replacer.Replace(s) |
| 1643 | } |
| 1644 | |
| 1645 | func sortedKeys(m map[string]string) []string { |
| 1646 | keys := make([]string, 0, len(m)) |
no outgoing calls
no test coverage detected