Skip to content

abdulahshoaib/HTML-Parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

HTML Parser

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.

Features

  • Validates HTML files or strings.
  • Provides feedback on formatting correctness.

How to Use

HTML Parser supports two command-line switches:

1. File Input (-f)

Use this option to validate an HTML file.

htmp -f <filename>

Example:

htmp -f example.html

2. String Input (-s)

Use this option to validate a string of HTML.

htmp -s "<html><body></body></html>"

Example:

htmp -s "<div><p>Hello World</p></div>"

Installation

Prerequisites

Ensure you have a C++ compiler installed on your system (e.g., g++, clang++).

Steps to Install

  1. Clone the Repository (if applicable):

    git clone https://github.com/yourusername/HTML-Parser.git
    cd HTML-Parser
  2. Compile the Program:

    g++ html_parser.cpp -o htmp
  3. Move to a Directory in Your PATH (optional):

    sudo mv htmp /usr/local/bin/

Alternative Installation via CMake

If you prefer to use CMake for building the project, you can do so as follows:

mkdir build
cd build
cmake ..
make

Example Usage

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>"

Output

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).

Contact

For any questions or feedback, feel free to reach out:

About

A CLI tool used to check for correct HTML formatting

Topics

Resources

Stars

Watchers

Forks