private string ScanNCName()
        {
            Debug.Assert(xmlCharType.IsStartNCNameChar(curChar));
            int start = curIndex;

            while (xmlCharType.IsNCNameChar(curChar))
            {
                NextChar();
            }
            return(xpathExpr.Substring(start, curIndex - start));
        }
        private string ScanName()
        {
            Debug.Assert(xmlCharType.IsStartNCNameChar(this.CurerntChar));
            int start = xpathExprIndex - 1;
            int len   = 0;

            while (xmlCharType.IsNCNameChar(this.CurerntChar))
            {
                NextChar(); len++;
            }
            return(this.xpathExpr.Substring(start, len));
        }
        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);
        }
        public static bool ValidatePrefix(string prefix)
        {
            if (prefix.Length == 0)
            {
                return(false);
            }
            XmlCharType xmlCharType = XmlCharType.Instance;

            if (!xmlCharType.IsStartNCNameChar(prefix[0]))
            {
                return(false);
            }
            for (int i = 1; i < prefix.Length; i++)
            {
                if (!xmlCharType.IsNCNameChar(prefix[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #5
0
        //
        // Parsing qualified names
        //

        private static string ParseNCName(string qname, ref int position)
        {
            int qnameLength = qname.Length;
            int nameStart   = position;

            if (
                qnameLength == position ||                           // Zero length ncname
                !XmlCharType.IsStartNCNameChar(qname[position])      // Start from invalid char
                )
            {
                throw new XsltException(Res.Xslt_InvalidQName, qname);
            }

            position++;

            while (position < qnameLength && XmlCharType.IsNCNameChar(qname[position]))
            {
                position++;
            }

            return(qname.Substring(nameStart, position - nameStart));
        }