| 1250 | } |
| 1251 | |
| 1252 | func isNameString(s string) bool { |
| 1253 | if len(s) == 0 { |
| 1254 | return false |
| 1255 | } |
| 1256 | c, n := utf8.DecodeRuneInString(s) |
| 1257 | if c == utf8.RuneError && n == 1 { |
| 1258 | return false |
| 1259 | } |
| 1260 | if !unicode.Is(first, c) { |
| 1261 | return false |
| 1262 | } |
| 1263 | for n < len(s) { |
| 1264 | s = s[n:] |
| 1265 | c, n = utf8.DecodeRuneInString(s) |
| 1266 | if c == utf8.RuneError && n == 1 { |
| 1267 | return false |
| 1268 | } |
| 1269 | if !unicode.Is(first, c) && !unicode.Is(second, c) { |
| 1270 | return false |
| 1271 | } |
| 1272 | } |
| 1273 | return true |
| 1274 | } |
| 1275 | |
| 1276 | // These tables were generated by cut and paste from Appendix B of |
| 1277 | // the XML spec at https://www.xml.com/axml/testaxml.htm |