tinyxml2 icon indicating copy to clipboard operation
tinyxml2 copied to clipboard

add FirstDescendantElement and LastDescendantElement functions

Open sunnyqeen opened this issue 2 years ago • 0 comments

The normal way to find a descendent is FirstChildElement()->FirstChildElement() But it lacks the null check, so I added the 2 functions to cover the null check.

The last string of the list should be null, and an empty string in the list matches any child, example: static const char* names[] = { "son", "grandson", nullptr }; FirstDescendantElement(names);

static const char* names[] = { "", "level2", nullptr }; FirstDescendantElement(names);

sunnyqeen avatar Sep 08 '22 11:09 sunnyqeen