internal static void ParseNameTestThrow(string s, out string prefix, out string localName)
{
int len, lenLocal, offset;
if (s.Length != 0 && s[0] == '*')
{
// '*' as a NameTest
prefix = localName = null;
len = 1;
}
else
{
// Parse NCName (may be prefix, may be local name)
len = ParseNCName(s, 0);
if (len != 0)
{
// Non-empty NCName, so look for colon if there are any characters left
localName = s.Substring(0, len);
if (len < s.Length && s[len] == ':')
{
// First NCName was prefix, so look for local name part
prefix = localName;
offset = len + 1;
if (offset < s.Length && s[offset] == '*')
{
// '*' as a local name part, add 2 to len for colon and star
localName = null;
len += 2;
}
else
{
lenLocal = ParseNCName(s, offset);
if (lenLocal != 0)
{
// Local name part found, so increase total NameTest length
localName = s.Substring(offset, lenLocal);
len += lenLocal + 1;
}
}
}
else
{
prefix = string.Empty;
}
}
else
{
// Make the compiler happy
prefix = localName = null;
}
}
if (len == 0 || len != s.Length)
{
// If the string is not a valid NameTest, then throw
ThrowInvalidName(s, 0, len);
}
}