Default font size Decrease font size   |   Increase font size  |   Skip navigation

Success Criterion 4.1.1 Parsing: [Level A]

Techniques

G134: Validating web pages

Every page should be validated. In order to achieve this correctly every HTML and XHTML page should have a !DOCTYPE statement which intructs the browser which version of HTML is being used. Other XML documents should refer to a Document Type Definition (DTD) or other type of XML schema.

The example below shows the !DOCTYPE statement for Transitional XHTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

G192: Fully conforming to specifications

Validation is not guaranteed to catch all cases where content fails to conform to specification. Therefore specification requirements that can not be identified by validation must also be checked and any failures are corrected.

H88: Using HTML according to spec

Occasionally additional features are introduced. Often these are only supported by a particular user agent and therefore should not be used. It may be the case that a number of user agents support the feature but if this feature does not conform to any standard there is no guarantee of how it will behave in different user agents.

It is possible to use a feature in a manner which is not supported by the specification, for example, using semantic type elements to perform some decorative task. A classic example of previous bad habits was to use the dl, dt and dd elements to provide indentation for text.

In the following example, you can see blockquote being used incorrectly to indent some text.

<h4>Using HTML according to spec</h4>
<blockquote>
<p>Occasionally additional features are introduced. Often these are only supported by a particular user agent and therefore should not be used. It may be the case that a number of user agents support the feature but if this feature does not conform to any standard there is no guarantee of how it will behave in different user agents.</p>
</blockquote>

Using HTML according to spec

Occasionally additional features are introduced. Often these are only supported by a particular user agent and therefore should not be used. It may be the case that a number of user agents support the feature but if this feature does not conform to any standard there is no guarantee of how it will behave in different user agents.

Specified rules about the structure of start and end tags, attributes and values, nesting of elements, etc. should be adhered to so as to ensure that user agents will parse the content in a way to achieve the intended document representation.

H74: Start and End tags

There must be a closing tag for elements that require one. Conversely, there shouldn't be a closing tag for an element where closing tags are forbidden. Ensure that all start and end tags are correctly nested.

H93: Unique ids

Element ids must be unique on a page. Although the page may not break, it will not validate correctly and any other technologies (e.g. JavaScript) will have problems identifying which element it is targetting.

H94: Duplicate attributes

Duplicate attributes on the same element are known to cause problems for assistive technologies when they are trying to parse content on any such elements.

H75: Well-formed web pages

If all the techniques above are applied and the web page conforms to the technolgy standards with no syntax errors then a document is considered as well formed.

Other techniques

Failures

F70: incorrect use of start and end tags or attribute markup

Missing angle bracket
<p This paragraph has an incomplete opening tag</p>
Missing slash
<p>This paragraph has a slash missing from the closing tag<p>
Missing quote
<p id="para1 >Start tag has unbalanced quotes</p>
No spacing
<p id="para1"name="para1"> No space between attributes</p>
No quotes with whitespace
<p title=no quote example id=para1> Not clear where the boundary of each attribute is because of whitespace in unquoted attribute.</p>
Missing end tag

Although some HTML specifications do not require an end tag, it should be present in order for assitive technologies to have a better chance of interpreting the page.

<p id="para1" name="para1"> No end tag.

F77: Duplicate values of type ID

<input id="name" title="First name" type="text" />
<input id="name" title="Last name" type="text" />

F17: Insufficient information in DOM to determine one-to-one relationships (e.g., between labels with same id) in HTML

Failure here is where there is ambiguity on the web page possibily causing assitive technologies to present incorrect information. The previous failure F77 is covered here. It could also be a case of a duplicate accesskey or of a non-existent reference.

<input id="first" accesskey="n" title="First name" type="text" />
<input id="last" accesskey="n" title="Last name" type="text" />
<label for="name" />
<input id="last" title="Last name" type="text" />

Other Failures

How to correct

In all these examples, validation of the HTML will indicate where the coding is incorrect.

Top