From: Jimmy Z. <cra...@co...> - 2006-06-14 06:44:14
|
Yes, but vn.getCurrentIndex() will get you the index value of the cursor = element... ----- Original Message -----=20 From: Aakash Jain=20 To: Jimmy Zhang=20 Sent: Tuesday, June 13, 2006 11:36 PM Subject: Re: find attribute value by index getRootIndex() returns the inddex of the root element of the xml tree. eg: <root> <child attr1=3D"val1"/> <child attr1=3D"val2"/> </root> so, no matter where your context object is , it will always return = index for "root".=20 On 6/14/06, Jimmy Zhang <cra...@co...> wrote: It can be done let me give an example.. The XML snippet is as follows: <test attr1=3D'val1' attr2 =3D 'val2' /> vn.getRootIndex() will get you the index value of "test" element, = which is root....=20 say its index is 1; then next few tokens attr1 ---> index value is 2 val1 =3D=3D>index value is 3 attr2 ----> index is 4 val2 =3D=3D> index value is 5 make sure you check for the token type at the given index values=20 using vn.getTokenType(int i).. possible token types are ATTR_VAL, ATTR_NAME, ATTR_NS (for = namespace) >How can we find an attribute's value by number? >Like we have VTDNav.getAttrValue(String)=20 >but that gives the value given the key. >What if i dont know the key? >Help!!!!!!!!!!!!!! --=20 " There are 10 types of people in this world, those who understand = binary and others who don't. "=20 Aakash Jain PUCSD Ph : 91 9844223652 |