Techniques for WCAG 2.0

On this page:

-

# H75: Ensuring that Web pages are well-formed

## Applicability

Any XML-based markup languages.

This technique relates to:

- Success Criterion 4.1.1 (Parsing)
  - How to Meet 4.1.1 (Parsing)
  - Understanding Success Criterion 4.1.1 (Parsing)

## Description

The objective of this technique is to avoid key errors that are known to cause problems for assistive technologies when they are trying to parse contents. Well-formedness is checked by parsing the document with a conforming XML parserand checking if the validation report mentions well-formedness errors. Every conforming XML parser is required to check well-formedness and stop normal processing when a well-formedness error is found (a conforming XML parser does not need to support validation).

## Examples

### Example 1:

XML files include a document type declaration, a xsi:schemaLocation attribute or other type of reference to a schema. The developer can use off-line or online validators, an XML editor or an IDE with XML support (see Resources below) to check well-formedness.

### Example 2:

When XML files do not include a document type declaration, a xsi:schemaLocation attribute or a processing instruction referencing a schema even though there is a schema for them, the relevant schema is specified by a command line instruction, a user dialog or a configuration file, and the XML files are checked against the schema.

### Example 3:

When XML files do not include a document type declaration, a xsi:schemaLocation attribute or a processing instruction referencing a schema even though there is a schema for them, the namespace is dereferenced to retrieve a schema document or resource directory (Resource Directory Description Language: RDDL), and the XML files are checked against the schema.

### Example 4:

When a Website generates XML dynamically instead of serving only static documents, a developer can use XMLUnit, XML Test Suite or a similar framework to test the generated XML code.

## Resources

Resources are for information purposes only, no endorsement implied.

- Well-Formed XML Documents in Extensible Markup Language (XML) 1.0 (Third Edition), W3C Recommendation 04 February 2004.

- Well-Formed XML Documents in Extensible Markup Language (XML) 1.1, W3C Recommendation 04 February 2004.

- 4.3.2 Well-Formed Parsed Entities in Extensible Markup Language (XML) 1.1, W3C Recommendation 04 February 2004.

For other resources, see G134: Validating Web pages.

## Related Techniques

(none currently listed)

## Tests

### Procedure

1. Load each file into a validating XML parser.

2. Check that there are no well-formedness errors.

### Expected Results

Step 2 is true.

- Top
- Contents
- Intro
- Previous: Technique H74
- Next: Technique H76