/// <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); }
/// <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> public 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"); } }