From: Ludovic M. <lmu...@ca...> - 2007-02-05 16:26:33
|
Hi,=20 Let's say i've got this XML file: <?xml version=3D'1=2E0' ?> <a> <b x=3D"y">100</b> <c> <d>200</d> </c> <c> <d>300</d> <d>400</d> </c> </a> Using this code, to retreve nodes works fine: if (selectXPath(ap,L"c")) { bind(ap,vn); while(evalXPath(ap)!=3D -1)=20 { l =3D getElementFragment(vn); offset =3D (int) l; len =3D (int) (l>>32); fwrite((char *)(xml+offset),sizeof(UByte),len,fo); fwrite((char *) sm,sizeof(UByte),strlen(sm),fo); }=20 } I get my two nodes, but if my xpath query becomes b/text() for exemple I= dont' get what I should=2E Other example if my xpath query is b\@x i don't get what I should What is the "normal" way to get correct return for all xpath query ? Should I test my query to use one code or another code ? I'll be glad if someone could send/tell me how to print, let's say= fprintf(stdout,"%ls",answerToMyQuery); the correct answer to all my xpath= queries=2E Tks This message contains information that may be privileged or confidential= and is the property of the Capgemini Group=2E It is intended only for the= person to whom it is addressed=2E If you are not the intended recipient, = you are not authorized to read, print, retain, copy, disseminate, = distribute, or use this message or any part thereof=2E If you receive this= message in error, please notify the sender immediately and delete all = copies of this message=2E |
From: Jimmy Z. <cra...@co...> - 2007-02-05 20:48:27
|
I will investigate and get back to you soon... ----- Original Message -----=20 From: Ludovic MUSSIER=20 To: vtd...@li...=20 Sent: Monday, February 05, 2007 8:24 AM Subject: [Vtd-xml-users] Xpath Queries Hi,=20 Let's say i've got this XML file: <?xml version=3D'1.0' ?> <a> <b x=3D"y">100</b> <c> <d>200</d> </c> <c> <d>300</d> <d>400</d> </c> </a> Using this code, to retreve nodes works fine: if (selectXPath(ap,L"c")) { bind(ap,vn); while(evalXPath(ap)!=3D -1)=20 { l =3D getElementFragment(vn); offset =3D (int) l; len =3D (int) (l>>32); fwrite((char *)(xml+offset),sizeof(UByte),len,fo); fwrite((char *) sm,sizeof(UByte),strlen(sm),fo); }=20 } I get my two nodes, but if my xpath query becomes b/text() for exemple = I dont' get what I should. Other example if my xpath query is b\@x i don't get what I should What is the "normal" way to get correct return for all xpath query ? Should I test my query to use one code or another code ? I'll be glad if someone could send/tell me how to print, let's say = fprintf(stdout,"%ls",answerToMyQuery); the correct answer to all my = xpath queries. Tks This message contains information that may be privileged or = confidential and is the property of the Capgemini Group. It is intended = only for the person to whom it is addressed. If you are not the intended = recipient, you are not authorized to read, print, retain, copy, = disseminate, distribute, or use this message or any part thereof. If you = receive this message in error, please notify the sender immediately and = delete all copies of this message. =20 -------------------------------------------------------------------------= ----- = -------------------------------------------------------------------------= Using Tomcat but need to do more? Need to support web services, = security? Get stuff done quickly with pre-integrated technology to make your job = easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache = Geronimo = http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 -------------------------------------------------------------------------= ----- _______________________________________________ Vtd-xml-users mailing list Vtd...@li... https://lists.sourceforge.net/lists/listinfo/vtd-xml-users |
From: Jimmy Z. <cra...@co...> - 2007-02-05 21:22:24
|
Ok, after looking at your code closely I think I know what causes the problems that you have...=20 GetElementFragment() is a function that will get you the offset and length of a selected element... when you use xpath to select a text node or attr val, you ought to select the offset and length of the text token and attrbute value token, *not* the offset and length of the containg element... so I recommend that instead of using while(evalXPath(ap)!=3D -1)=20 do=20 int i; while ((i=3DevalXPath(ap))!=3D -1){ // here to check the token type of i if (getTokenType(vn, i) =3D=3D ELEMENT){ // get token type } else { int offset =3D getTokenOffset(vn, i); int len =3D getTokenLength(vn, i); } } ----- Original Message -----=20 From: Ludovic MUSSIER=20 To: vtd...@li...=20 Sent: Monday, February 05, 2007 8:24 AM Subject: [Vtd-xml-users] Xpath Queries Hi,=20 Let's say i've got this XML file: <?xml version=3D'1.0' ?> <a> <b x=3D"y">100</b> <c> <d>200</d> </c> <c> <d>300</d> <d>400</d> </c> </a> Using this code, to retreve nodes works fine: if (selectXPath(ap,L"c")) { bind(ap,vn); while(evalXPath(ap)!=3D -1)=20 { l =3D getElementFragment(vn); offset =3D (int) l; len =3D (int) (l>>32); fwrite((char *)(xml+offset),sizeof(UByte),len,fo); fwrite((char *) sm,sizeof(UByte),strlen(sm),fo); }=20 } I get my two nodes, but if my xpath query becomes b/text() for exemple = I dont' get what I should. Other example if my xpath query is b\@x i don't get what I should What is the "normal" way to get correct return for all xpath query ? Should I test my query to use one code or another code ? I'll be glad if someone could send/tell me how to print, let's say = fprintf(stdout,"%ls",answerToMyQuery); the correct answer to all my = xpath queries. Tks This message contains information that may be privileged or = confidential and is the property of the Capgemini Group. It is intended = only for the person to whom it is addressed. If you are not the intended = recipient, you are not authorized to read, print, retain, copy, = disseminate, distribute, or use this message or any part thereof. If you = receive this message in error, please notify the sender immediately and = delete all copies of this message. =20 -------------------------------------------------------------------------= ----- = -------------------------------------------------------------------------= Using Tomcat but need to do more? Need to support web services, = security? Get stuff done quickly with pre-integrated technology to make your job = easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache = Geronimo = http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 -------------------------------------------------------------------------= ----- _______________________________________________ Vtd-xml-users mailing list Vtd...@li... https://lists.sourceforge.net/lists/listinfo/vtd-xml-users |