matchTokenString() public method

Match the string against the token at the given index value. When a token is an attribute name or starting tag, qualified name is what gets matched against This method has to take care of the underlying encoding conversion as well as entity reference comparison
When if the underlying byte /// content contains various errors. Notice that we are being conservative in making little assumption on /// the correctness of underlying byte content. This is because the VTD can be generated by another /// machine such as a load-balancer. ///
public matchTokenString ( int index, System s ) : bool
index int int ///
s System String ///
return bool
Esempio n. 1
0
        public bool eval2(VTDNav vn)
        {
            switch (testType)
            {
                case NAMETEST:
                    if (vn.atTerminal)
                        return false;
                    switch (type)
                    {
                        case 0: return true;
                        case 1: return vn.matchElement(nodeName);
                        case 2: return vn.matchElementNS(URL, localName);
                    }
                    return false;
                case NODE:
                    return true;
                case TEXT:
                    if (!vn.atTerminal)
                        return false;
                    int t = vn.getTokenType(vn.LN);
                    if (t == VTDNav.TOKEN_CHARACTER_DATA
                            || t == VTDNav.TOKEN_CDATA_VAL)
                    {
                        return true;
                    }
                    return false;

                case PI0:
                    if (!vn.atTerminal)
                        return false;
                    if (vn.getTokenType(vn.LN) == VTDNav.TOKEN_PI_NAME)
                    {
                        return true;
                    }
                    return false;
                case PI1:
                    if (!vn.atTerminal)
                        return false;
                    if (vn.getTokenType(vn.LN) == VTDNav.TOKEN_PI_NAME)
                    {
                        return vn.matchTokenString(vn.LN, nodeName);
                    }
                    return false;

                default: // comment
                    if (!vn.atTerminal)
                        return false;
                    if (vn.getTokenType(vn.LN) == VTDNav.TOKEN_COMMENT)
                    {
                        return true;
                    }
                    return false;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="vn"></param>
        /// <param name="s"></param>
        /// <returns></returns>
        private bool lang(VTDNav vn, String s)
        {
            // check the length of s 
            bool b = false;
            vn.push2();
            try
            {
                while (vn.getCurrentDepth() >= 0)
                {
                    int i = vn.getAttrVal("xml:lang");
                    if (i != -1)
                    {
                        b = vn.matchTokenString(i, s);
                        break;
                    }
                    vn.toElement(VTDNav.P);
                }
            }
            catch (NavException e)
            {

            }
            vn.pop2();
            return b;
        }