HTML Parser is a simple command-line interface (CLI) tool designed to determine if an HTML file or string is correctly formatted. This tool helps you quickly validate HTML structures and identify mismatched tags.
- Validates HTML files or strings.
- Provides feedback on formatting correctness.
HTML Parser supports two command-line switches:
Use this option to validate an HTML file.
htmp -f <filename>
Example:
htmp -f example.html
Use this option to validate a string of HTML.
htmp -s "<html><body></body></html>"
Example:
htmp -s "<div><p>Hello World</p></div>"
Ensure you have a C++ compiler installed on your system (e.g., g++, clang++).
-
Clone the Repository (if applicable):
git clone https://github.com/yourusername/HTML-Parser.git cd HTML-Parser
-
Compile the Program:
g++ html_parser.cpp -o htmp
-
Move to a Directory in Your PATH (optional):
sudo mv htmp /usr/local/bin/
If you prefer to use CMake for building the project, you can do so as follows:
mkdir build
cd build
cmake ..
make
To check an HTML file:
htmp -f myfile.html
To check an inline HTML string:
htmp -s "<html><body><h1>Hello World</h1></body></html>"
The program will output whether the HTML is correctly formatted or not:
- Formatted Correctly: Indicates that all tags are properly closed and nested.
- Format INCORRECT!: Indicates there are mismatched or unclosed tags along with row and column number the error was found at(Error: [error type]:row:col).
For any questions or feedback, feel free to reach out:
- Abdullah: [email protected]
- GitHub: WhoisCipher