PCL
|
A functional class for filtering XML elements. More...
#include <XML.h>
Public Member Functions | |
virtual | ~XMLElementFilter () |
virtual bool | operator() (const XMLElement *parent, const String &name) const =0 |
virtual bool | operator() (const XMLElement *parent, const String &name, const XMLAttributeList &attributes) const |
Element filters can be used with XMLDocument objects to reject elements selectively while parsing an XML document.
When an element filter has been defined, XMLDocument calls its reimplemented operator()( const XMLElement*, const String& ) member function when an element's start-tag is found, passing its parent element and name to the function. If the function returns false, the element is rejected, including all of its child nodes, and the parsing process continues after the corresponding end-tag.
If the first function call described above returns true, XMLDocument calls operator()( const XMLElement*, const String&, const XMLAttributeList& ) with the parent, name and attributes of the element. Again, if the function returns false the element is skipped completely until its end-tag is found. If the function returns true, the element is accepted, added to the DOM being generated, and parsed.
Element filters can be useful to accelerate XML document parsing and reduce its memory consumption considerably, when only a subset of possible elements is required.
|
inlinevirtual |
|
pure virtual |
Returns true if an XML element with the specified name and parent element is acceptable; false if the element must be ignored.
|
inlinevirtual |
Returns true if an XML element with the specified name, attributes and parent element is acceptable; false if the element must be ignored. This function is only called after a previous call to operator()( const XMLElement*, const String& ) has returned true for the same element.
The default implementation returns true, which facilitates implementations where elements are only filtered by their names.