This is an HTML parser for C++. It parses HTML files into C++ objects. It is implemented according to the HTML parsing algorithm.
The reason I name it as barca-parser is because I am a big fan of FC Barcelona. ๐ค
This light weight HTML parser is a good example for understanding basic string parsing, usage of data structure and recursions. And it is also usable.
###Stack Stack is used when processing the HTML buffer.
When reading in a starting tag, pop the last Dom object, add the current Dom to last Dom's children list, push to the stack.
When reading in a ending tag, pop the last Dom out of the stack.
The remaining Dom in the Stack is the Dom object that stores all the HTML elements.
A Dom object is a recursive tree structure. It contains its tag elements(tag name, attribute pairs) and its list of children.
test the parser:
$ make testparser
$ ./main
test the Dom object:
$ make testdom
$ ./main