MCD_STR CMarkup::GetTagName() const;

The GetTagName method returns the tag name of the current main position element. If there is no current position, it returns an empty string. So when you call FindElem() without an argument, you can call this diagnostic method to determine the tag name of the current element. That allows you to loop through a set of sibling elements and act according to the elements you encounter.