#ifndef XMLTOOLFINDERHH #define XMLTOOLFINDERHH #include #include "ExpatInterface/Element.h" namespace xmlTool { class Finder { private: const xml::Element * _lastMatch; public: // The following method looks under the supplied element "elt" // for elements whose tag matches "tag" and which have an // attribute "attType" which has the value "attValue". // For the moment, if a tag match is made, it is assumes that the // relevant attType exists. This can be made safer once // xml::Element::getAttributes() is fixed. // It is a fatal error to supply search criteria to this method // which are ambiguous, i.e. there must be EXACTLY one element // which matches. // NB, you can omit the attribute stuff if that is not // important. Then just elements matching the tag will be // found. // If you omit the attribute stuff, you can miss the tag out // too, and just count elements, but it's a fatal error to // omit just the tag (at least until xml::Element::getAttributes() // gets fixed). const xml::Element & findUnderTheUniqueElement ( const xml::Element & elt, const std::string & tag =string(""), const std::string & attType =string(""), const std::string & attValue=string("")); // The following method will return the number of matches of // a query identical to that described in the previous method. int countUnderElementsMatching(const xml::Element & elt, const std::string & name =string(""), const std::string & attType =string(""), const std::string & attValue=string("")); }; } // End of xmlTool namespace #endif