| Package | Kind | Role |
|---|---|---|
| library | Raw lexical scanner; produces a |
|
| library | Groups tokens into structured |
|
| library | Drives the Lexer, applies the eight structural rules, and returns a |
|
| executable ( |
CLI orchestration - parses arguments, walks directories, calls Validator, prints the report |
# 1. Build (from the CsPageValidator/ solution root) dotnet build # 2. Validate a single file dotnet run --project EntryPoint -- index.html # 3. Validate a directory tree, quiet mode (errors only) dotnet run --project EntryPoint -- -r -q ./site # 4. Validate with pass/fail summary dotnet run --project EntryPoint -- -r -s ./site # 5. Or run the built executable directly EntryPoint/bin/Debug/net10.0/page_validator -r -s ./site
| Option | Argument | Default | Meaning |
|---|---|---|---|
| file or directory | (required) | One or more HTML files or directories to validate | |
| (flag) | off | Descend into subdirectories | |
| (flag) | off | Print only files with errors; suppress PASS lines | |
| (flag) | off | Print pass/fail count after all files are processed | |
| (flag) | off | Print help and exit |
PASS site/index.html
FAIL site/about.html
[tag-nesting] 14:3 - </div> does not match open <p>
[duplicate-id] 22:10 - duplicate id 'header'
PASS site/contact.html
2 passed, 1 failed
| Rule | What is checked |
|---|---|
| Document begins with |
|
| Exactly one |
|
| Every open tag has a matching close tag in the correct order | |
| Void elements ( |
|
| All attribute values are quoted | |
| No two elements share the same |
TagOpen, TagClose, AttrName, AttrValue, AttrUnquoted, SelfClose, TagEnd, Text, Comment, Doctype, EofEvery token carries a
OpenTag, SelfClosingTag, CloseTag, TextNode, CommentNode, DoctypeDecl
# Build all projects (from the CsPageValidator/ solution root) dotnet build # Build Release configuration dotnet build -c Release # Run all unit tests dotnet test # Run with verbose test output dotnet test --logger "console;verbosity=detailed"
| Test Project | Coverage |
|---|---|
| tags, attributes, doctypes, comments, position tracking | |
| tag grouping, attribute collection, case normalization | |
| valid documents, missing elements, nesting errors, void elements, duplicate IDs, unquoted attributes |
# Run all tests from the solution root dotnet test # Run tests for a single project dotnet test Validator.Tests