Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected internal int iterateNameSpace()
        {
            if (vn.ns == false)
            {
                return(-1);
            }
            if (ft != false)
            {
                ft    = false;
                index = vn.getCurrentIndex2() + 1;
            }
            else
            {
                index += 2;
            }

            while (index < size)
            {
                int type = vn.getTokenType(index);
                if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS)
                {
                    if (type == VTDNav.TOKEN_ATTR_NS)
                    {
                        if (name.Equals("*") ||
                            vn.matchRawTokenString(index, name2)
                            )
                        {
                            if (checkNsUniqueness(index))
                            {
                                vn.LN         = index;
                                vn.atTerminal = true;
                                return(index);
                            }
                        }
                    }
                    index += 2;
                }
                else
                {
                    vn.atTerminal = false;
                    if (vn.toElement(VTDNav.P) == false)
                    {
                        return(-1);
                    }
                    else
                    {
                        index = vn.getCurrentIndex2() + 1;
                    }
                }
            }

            return(-1);
        }
Exemplo n.º 2
0
        /// <summary> This method implements the attribute axis for XPath</summary>
        /// <returns> the integer of the selected VTD index for attribute name
        /// </returns>
        /// <throws>  PilotException </throws>
        protected internal int iterateAttr()
        {
            switch (iter_type)
            {
            case ATTR:
                if (String.CompareOrdinal(name, "*") == 0)
                {
                    if (ft != false)
                    {
                        ft    = false;
                        index = vn.getCurrentIndex2() + 1;
                    }
                    else
                    {
                        index += 2;
                    }
                    if (vn.ns == false)
                    {
                        while (index <= size)
                        {
                            int type = vn.getTokenType(index);
                            if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS)
                            {
                                vn.LN = index;
                                return(index);
                            }
                            else
                            {
                                return(-1);
                            }
                        }
                        return(-1);
                    }
                    else
                    {
                        while (index <= size)
                        {
                            int type = vn.getTokenType(index);
                            if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS)
                            {
                                if (type == VTDNav.TOKEN_ATTR_NAME)
                                {
                                    vn.LN = index;
                                    return(index);
                                }
                                else
                                {
                                    index += 2;
                                }
                            }
                            else
                            {
                                return(-1);
                            }
                        }
                        return(-1);
                    }
                }
                else
                {
                    if (ft == false)
                    {
                        return(-1);
                    }
                    else
                    {
                        ft = false;
                        int i = vn.getAttrVal(name);
                        if (i != -1)
                        {
                            vn.LN = i - 1;
                            return(i - 1);
                        }
                        else
                        {
                            return(-1);
                        }
                    }
                }
            //goto case ATTR_NS;

            case ATTR_NS:
                if (ft == false)
                {
                    return(-1);
                }
                else
                {
                    ft = false;
                    int i = vn.getAttrValNS(URL, localName);
                    if (i != -1)
                    {
                        vn.LN = i - 1;
                        return(i - 1);
                    }
                    else
                    {
                        return(-1);
                    }
                }
            //goto default;

            default:
                throw new PilotException("invalid iteration type");
            }
        }