In order to use TinyXPath, one need to include the xpath_processor.h file and link with the tinyxpath code.
In order to compute an XPath expression, one need to :
As an alternative if you know beforehand what result type you're looking for, you can use the following alternate member functions at step 2 :
once again, the choice of v_get_xpath_base or its two alternates depend if you know whether you know if you wait for an attribute or another type of node, or not.
Now, to make it really simple to use, if you only look for one result at a time, you can include only the following header :
and then use the following set of functions :
or if you need to know whether there was some error with the XPath evaluation :
Be aware that the input tree user value is modified after the call : all user data (TiXmlNode::SetUserData) are replaced by the document order (XPath meaning).
Important notice : the whole TinyXPath engine is declared in the TinyXPath namespace. This means that all your declarations have to be prefixed with TinyXPath:: or, if you don't fear collisions with the classes or functions declared in TinyXPath, you can add the following declaration after the #include of xpath_processor.h or xpath_static.h :
using namepsace TinyXPath;
TinyXPath is covered by the zlib license. Here it is :
www.sourceforge.net/projects/tinyxpath Copyright (c) 2002-2004 Yves Berquin (firstname.lastname@example.org) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution.