I have integrated TinyXPath with this plugin
If anyone is interested, I have integrated the TinyXPath library with this plugin. It worked like a charm the very first time (surprised the heck out of me). Here are the steps:
1) Download TinyXPath from
2) Compile the TinyXPath LIB according to the instructions here
http://tinyxpath.sourceforge.net/doc/index.html
3) Copy the tinyxpath.lib file along with all the TinyXPath .h (header files), excluding the TinyXML header files, to the XML Plugin source directory.
4) Add
#include "xpath_static.h"
to the top of xml.cpp (XML Plugin source file)
5) Add the following code block to xml.cpp:
extern "C" void __declspec(dllexport) _GotoXPath(HWND hwndParent, int string_size,
char *variables, stack_t **stacktop)
{
EXDLL_INIT();
{
popstring(szBuf);
nodeTmp = TinyXPath::XNp_xpath_node(node, szBuf);
if(nodeTmp)
{
node=nodeTmp;
pushstring("0");
return;
}
else
{
pushstring("-1");
}
}
}
6) Compile the XML Plugin source to the xml.dll file. Place the new xml.dll file in the NSIS/plugins directory (duh!)
7) Add the following code block to the XML.nsh file located in the NSIS/include directory:
!define xml::GotoXPath `!insertmacro xml::GotoXPath`
!macro xml::GotoXPath _PATH _ERR
xml::_GotoXPath /NOUNLOAD `${_PATH}`
Pop ${_ERR}
!macroend
Viola! You're done. Use
${xml::GotoXPath} "path" $errvar
in your installer script and the current node gets changed to the first node matching the XPath expression. If I have time, or someone else beats me to it, iterative expression matching could easily be added by storing the XPath state (by using the xpath_processor.h rather than xpath_static.h).
Ask if you need any help. Let me know if this helps. And thank you "Instructor" for the Xml Plugin (way better than the rest of them)