A simple html parser written in c++
add_subdirectory(PATH_TO_THIS_LIBRARY)
# ... add_executable or simmilair
target_link_libraries(${PROJECT_NAME} PRIVATE cpp-html-parser)
#include <htmlparser.hpp>
int main () {
using namespace parser;
// parse the html wstring
HTMLElement document = parseHTML("<h1>Hello</h1>");
// print the h1 tag
std::cout << document.children.at(0)->tag << "\n";
return 0;
}
only needs a tagname to create the element
HTMLElement::HTMLElement(const std::string& tag);
returns an optional pointer to the element with the specified id
std::optional<HTMLElement*> HTMLElement::GetElementById(const std::string& idName);
returns a list of element pointers which include the specified class name
std::vector<HTMLElement*> HTMLElement::GetElementsByClassName(const std::string& className);
returns a list of element pointers which include the specified tag name
std::vector<HTMLElement*> HTMLElement::GetElementsByTagName(const std::string& tagName);