This example parses a document and sets it as the context item. It then executes an XQuery expression that navigates relative to the context item.
#include <iostream>
int main(int argc, char *argv[]) {
}
while(item = result->
next(context)) {
std::cout << UTF8(item->
asString(context)) << std::endl;
}
return 0;
}
Result execute(DynamicContext *context) const
Executes the query using the given DynamicContext, returning a lazy iterator over the results.
virtual void setContextItem(const Item::Ptr &item)=0
Set the context item to item.
virtual void setContextSize(size_t size)=0
Set the context size.
static XQQuery * parse(const XMLCh *query, DynamicContext *context=0, const XMLCh *queryFile=NULL, unsigned int flags=0, xercesc::MemoryManager *memMgr=xercesc::XMLPlatformUtils::fgMemoryManager, XQQuery *result=0)
Parse the expression contained in the given query string.
virtual void setContextPosition(size_t pos)=0
Set the context position.
virtual Sequence resolveDocument(const XMLCh *uri, const LocationInfo *location=0, const QueryPathNode *projection=0)=0
Resolve the given uri (and baseUri) to an XML document.