Skip to Content (Press Enter)

This document is a draft, and is designed to show changes from a previous version. It is presently showing added text,changed text,deleted text,[start]/[end] markers,and Issue Numbers.

Hide All Edits   |   Toggle Deletions  |   Toggle Issue Numbers   |   Toggle [start]/[end] Markers   |   Show All Edits

Changes are displayed as follows:

H75: Ensuring that [begin delete]all id attribute values are unique for the document AND that[end delete] Web pages are well-formed

Applicability

Any XML-based markup languages.

This technique relates to:

Description

[begin change]

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).

[end change]
[begin delete]

Both steps can be combined by validating the XML document and checking if the validation report mentions these two types of errors. However, if the XML document uses only the xml:id attribute as an ID attribute, validation is not necessary: parsing the XML document with a validating parser that supports the xml:id specification is sufficient.

[end delete]

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[begin delete] and to check that all id attribute values are unique[end delete].

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.

For other resources, see G134: Validating Web pages.

(none currently listed)

Tests

Procedure

  1. Load each file into a validating XML parser.

  2. Check that all id attribute values are unique in the file.

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

Expected Results

Step 2 is true.