Skip to content

Commit

Permalink
Validate HTML string before beginning parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
reesmichael1 committed Apr 15, 2017
1 parent dab177d commit 0ed2614
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/HTMLParser/HTMLParser.cpp
@@ -1,3 +1,5 @@
#include <iostream>

#include "../HTMLElements/HTMLBodyElement.hpp"
#include "../HTMLElements/HTMLTextElement.hpp"
#include "../HTMLElements/HTMLParagraphElement.hpp"
Expand Down Expand Up @@ -32,6 +34,9 @@ void HTMLParser::insert_html_element(const std::shared_ptr<HTMLElement> &element

Document HTMLParser::construct_document_from_string(std::wstring &html)
{
if (!tokenizer.is_valid_html_string(html))
std::cerr << "ERROR: HTML string is not valid! "
"Bad things may happen." << std::endl;
Document document = Document();

std::vector<std::shared_ptr<HTMLToken>> tokens =
Expand Down

0 comments on commit 0ed2614

Please sign in to comment.