public static bool LooksLikeExpandedXName(string name)
{
// XName permits strings of the form '{namespace}localname'. Detecting such cases allows
// YAXLib to support explicit namespace use.
// http://msdn.microsoft.com/en-us/library/system.xml.linq.xname.aspx
name = name.Trim();
// Needs at least 3 chars ('{}a' is, in theory, valid), must start with '{', must have a following closing '}' which must not be last char.
if (name.Length >= 3)
{
if (name[ 0 ] == '{')
{
int closingBrace = name.IndexOf('}', 1);
return closingBrace != -1 && closingBrace < (name.Length - 1);
}
}
return false;
}