| 12345678910111213141516171819202122232425262728293031323334353637383940414243 | func isValid(code string) bool {	st := make([]string, 0)	for i := 0; i < len(code); i++ {		if 0 < i && len(st) == 0 { // Unmatched content			return false		}		if strings.HasPrefix(code[i:], "<![CDATA[") { // Parse cdata			j := strings.Index(code[i+9:], "]]>")			if j < 0 {				return false			}			i += j + 11		} else if strings.HasPrefix(code[i:], "</") { // Parse end			i += 2			j := strings.Index(code[i:], ">")			if j < 0 {				return false			}			name := code[i : i+j]			if l := len(st); l == 0 || st[l-1] != name {				return false			} else {				st = st[:l-1]			}			i += j		} else if code[i] == '<' { // Parse begin			i += 1			j := strings.Index(code[i:], ">")			if j < 1 || 9 < j {				return false			}			name := code[i : i+j]			for _, r := range name {				if r < 'A' || 'Z' < r {					return false				}			}			st = append(st, name)			i += j		}	}	return len(st) == 0}
 |