Use Cases
Aspose.HTML FOSS for Python targets server-side HTML work where a browser is unavailable or unwanted. These are the scenarios the API is built around.
Cleaning and Rewriting Stored HTML
Backend services that accept user-submitted HTML parse it with HTMLDocument.parse(), restructure it through Document and Element operations, and serialize the result — with standards error recovery absorbing whatever malformed markup arrives.
Verifying Generated Markup in CI
Test suites assert on structure the same way this knowledge base’s own examples do: build or parse a tree, then check attributes, children, and — uniquely — computed styles via Element.get_computed_style(), so a stylesheet regression fails a test instead of production.
Style Computation Without a Browser
Email tooling and sanitizers need to know the style an element actually resolves to. The CSSOM layer answers with a real cascade — specificity, !important, and inheritance included — in pure Python, with no headless browser to provision.
Ingesting Legacy Documents
Archives arrive as bytes in unknown encodings. detect_encoding() classifies them (BOM and meta-prescan), get_canonical_name() normalizes label chaos, and the parser’s recovery behaviour handles decade-old markup.
Token-Level Tooling
Linters and sanitizer pre-passes consume Tokenizer.tokenize() output directly, inspecting StartTagToken attributes before any tree exists.
Controlled Script Processing
Documents that require scripting run under JSContext with module access constrained by ModuleRegistry and ModuleLoadPolicy — scripting when needed, sandboxed by construction.