All Downloads are FREE. Search and download functionalities are using the official Maven repository.

examples.BookMark.testBookMark.cpp Maven / Gradle / Ivy

Go to download

XimpleWare's VTD-XML is, far and away, the industry's most advanced and powerful XML processing model for SOA and Cloud Computing

There is a newer version: 2.13.4
Show newest version
#include "everything.h"
using namespace com_ximpleware;

// test book mark
int main(){
	VTDGen *vg = new VTDGen();
	AutoPilot *ap = new AutoPilot();
	if (vg->parseFile(true,"c:\\xml\\oldpo.xml")){
		VTDNav *vn;
		try{
			vn = vg->getNav();
			ap->bind(vn);
			BookMark *bm = new BookMark();
			bm->bind(vn);
			ap->selectXPath(L"/purchaseOrder/items/item[@partNum='872-AA']/USPrice[.>100]");
			//ap->selectXPath(L"/purchaseOrder/items/item[@partNum='872-AA']");
			ap->printExprString();
			printf("\n");
			int i=-1;
			while((i=ap->evalXPath())!=-1){
				// remember the cursor position after navigation using xpath
				bm->recordCursorPosition(vn); //recordCursorPosition2(bm) also works.
				printf(" index val ==> %d \n", vn->getCurrentIndex());
			}
			vn->toElement(ROOT); // set the cursor to root
			printf(" index val ==> %d \n", vn->getCurrentIndex());
			bm->setCursorPosition(); // set the cursor back to remembered position
			printf(" index val ==> %d \n", vn->getCurrentIndex());
		}catch(...){
		}

		delete vn->getXML();
		delete vn;
		//delete bm;
		delete ap;
	}

	delete vg;
	return 0;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy