I'm not sure if anybody is monitoring this forum, but I thought I would ask a question.
I am a newbie with TinyXPath -- I'm using it in a small project, and I have a section of code where I load a single XML file, and then need to process several XPath expressions against the same document. For example:
TinyXPath::xpath_processor xpathProc1(xmlDocument.RootElement(), "/test/node1/@value");
TIXML_STRING node1Value = xpathProc1.S_compute_xpath();
TinyXPath::xpath_processor xpathProc2(xmlDocument.RootElement(), "/test/node2/@value");
TIXML_STRING node2Value = xpathProc2.S_compute_xpath();
TinyXPath::xpath_processor xpathProc3(xmlDocument.RootElement(), "/test/node3/@value");
TIXML_STRING node3Value = xpathProc3.S_compute_xpath();
Is there a way to re-use an xpath_processor object, and just pass a new XPath expression in each time, rather than creating a new xpath_processor for each? The method I use above works, but it seems cumbersome.
Right now there's no other way, but it can easily be grouped together in a global function.
Thanks for your help. I've been shortening to the following, to avoid wearing out my keyboard. ;-) A wrapper class is a good idea.
TIXML_STRING fooValue = TinyXPath::xpath_processor(xmlDocument.RootElement(), "/test/foorbar/@value");
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.