PCL
pcl::XMLElementFilter Class Referenceabstract

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
 

Detailed Description

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.

Definition at line 2494 of file XML.h.

Constructor & Destructor Documentation

◆ ~XMLElementFilter()

virtual pcl::XMLElementFilter::~XMLElementFilter ( )
inlinevirtual

Virtual destructor.

Definition at line 2499 of file XML.h.

Member Function Documentation

◆ operator()() [1/2]

virtual bool pcl::XMLElementFilter::operator() ( const XMLElement parent,
const String name 
) const
pure virtual

Returns true if an XML element with the specified name and parent element is acceptable; false if the element must be ignored.

◆ operator()() [2/2]

virtual bool pcl::XMLElementFilter::operator() ( const XMLElement parent,
const String name,
const XMLAttributeList attributes 
) const
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.

Definition at line 2519 of file XML.h.


The documentation for this class was generated from the following file: