How To Use
 All Modules Pages

In the sections above all filter settings where used only for checking the contents of an XML tree. The tree itself was not affected. In some situations you may want to also change the tree and reduce its contents according to filter settings.

Example: Your test application may request detailed dump data from a component under test. For your test case only a part of the data is relevant. Using filter conditions you can transform and reduce the received xml data. The reduced data then can be stored within a logfile which you can compare with a predefned file with expected data.

// Define some filter
TTB::TheXmlCheck()->IgnoreNode("Group_C");
TTB::TheXmlCheck()->IgnoreAttribute("date");
TTB::TheXmlCheck()->UseAsPointerNode("PointsToSomethingElse");
TTB::TheXmlCheck()->UseAsPointerNode("PointsToNothing");
//...
// Change the contents of given XML document / tree according to
// current filter settings:
// - all attributes or nodes to ignore are removed from the tree
// - double values are adjusted to desired precision
// - pointer values are changed to "0" or "exists"
TTB::TheXmlCheck()->ApplyFilterToXmlTree(doc);
// Save the reduced tree to some logfile
const std::string MY_XML_FILE_PATH_FILTERED = MY_TEST_DIR + "/FilteredPugiXmlFile.xml";
TTB::TheXmlCheck()->SaveToFile(doc, MY_XML_FILE_PATH_FILTERED);