Return true if the character is within the allowed characters in an XML 1.0 document The list of allowed characters can be found here: https://www.w3.org/TR/xml/#charsets
(r rune)
| 400 | // Return true if the character is within the allowed characters in an XML 1.0 document |
| 401 | // The list of allowed characters can be found here: https://www.w3.org/TR/xml/#charsets |
| 402 | func validXMLChar(r rune) (ok bool) { |
| 403 | return r == 0x09 || |
| 404 | r == 0x0A || |
| 405 | r == 0x0D || |
| 406 | r >= 0x20 && r <= 0xD7FF || |
| 407 | r >= 0xE000 && r <= 0xFFFD || |
| 408 | r >= 0x10000 && r <= 0x10FFFF |
| 409 | } |
| 410 | |
| 411 | func hasInvalidXMLChar(str string) bool { |
| 412 | for _, s := range str { |