The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

W3C::XHTML::HTMLCompatChecker - The W3C XHTML/HTML Compatibility Checker

Checks XHTML documents (online or local) for compatibility with legacy HTML User-Agents.

DESCRIPTION

W3C::XHTML::HTMLCompatChecker can be used to check whether some content written in XHTML can safely be served as HTML (text/html) to User-Agents that can process HTML, but not XML.

This checker follows the guidelines for compatibility found in the XHTML 1.0 Specification, for XHTML 1.0 content served "as HTML" (i.e with the media type text/html). http://www.w3.org/TR/xhtml1/#guidelines

This checker also has a "any xhtml" mode, where any XHTML document, regardless of its media type, will be checked.

SYNOPSIS

    use W3C::XHTML::HTMLCompatChecker;
    my $checker = W3C::XHTML::HTMLCompatChecker->new();
    my @messages = $checker->check_uri("http://...  ");

API

Constructor

    $checker = W3C::XHTML::HTMLCompatChecker->new

Checker Methods

    $checker->check_uri("http://...  ")

Check an online XHTML 1.0 document, served as "text/html" media type, for incompatibilities with legacy HTML.

    $checker->check_uri("http://...  ", any_xhtml=>1)

Check any online XHTML document, regardless of doctype and media type for incompatibilities with legacy HTML.

    $checker->check_content("<!DOCTYPE html ...")

Check an XHTML 1.0 document (as string), for incompatibilities with legacy HTML.

    $checker->check_content("<!DOCTYPE html ...", any_xhtml=>1)

Check any XHTML document (as string), for incompatibilities with legacy HTML.

Returned Messages

The checker will return an array of hashes, each hash representing an error/warning/info, as follows:

severity

Severity of message: Error, Warning, Info, Hint or Abort

line

line where observation was made

(may be undefined for Abort messages)

column

column/offset where observation was made

(may be undefined for Abort messages)

message_text

Explanation of the message

cnum

Identifier for the relevant compatibility guideline

Example: 1 is http://www.w3.org/TR/xhtml1/#C_1

guideline_title

Title of the relevant guideline

Example: Element Minimization and Empty Element Content

Abort causes

If the any_xhtml parameter is not set, the checker will return a single Abort message if:

  • the document is not served as text/html (N/A for check_content), or

  • the document is not identifiable as XHTML 1.0, or

  • the document is not well-formed XML

If the any_xhtml parameter is set, the checker will return a single Abort message if the document is not well-formed XML.

BUGS

Public bug-tracking interface at http://www.w3.org/Bugs/Public/

AUTHOR

Developed as one of the Open Source projects at The World Wide Web Consortium http://www.w3.org/Status

Based on original code donated by Björn Höhrmann.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 545:

Non-ASCII character seen before =encoding in 'Björn'. Assuming UTF-8