System.Xml.Xsl.XsltOld.ProcessingInstructionAction.IsProcessingInstructionName C# (CSharp) Method

IsProcessingInstructionName() static private method

static private IsProcessingInstructionName ( string name ) : bool
name string
return bool
        internal static bool IsProcessingInstructionName(string name) {
            if (name == null) {
                return false;
            }

            int nameLength = name.Length;
            int position   = 0;
            XmlCharType xmlCharType = XmlCharType.Instance;

            while (position < nameLength && xmlCharType.IsWhiteSpace(name[position])) {
                position ++;
            }

            if (position >= nameLength) {
                return false;
            }

            if (position < nameLength && ! xmlCharType.IsStartNCNameChar(name[position])) {
                return false;
            }

            while (position < nameLength && xmlCharType.IsNCNameChar(name[position])) {
                position ++;
            }

            while (position < nameLength && xmlCharType.IsWhiteSpace(name[position])) {
                position ++;
            }

            if (position < nameLength) {
                return false;
            }

            if (nameLength == 3 &&
                (name[0] == CharX || name[0] == Charx) &&
                (name[1] == CharM || name[1] == Charm) &&
                (name[2] == CharL || name[2] == Charl)
            ) {
                return false;
            }

            return true;
        }
    }