Web Development
Web Developer Guidelines
Visual Design Recommendations

Checkpoint 2.6 - XML/XSLT

Do not create multiple element names that may be confused within the context of the document instance

XML Accessibility Guidelines

Guideline 2: Create semantically-rich languages

The flexibility that XML gives to a developer in user-defining element and attribute names can cause confusion where element names and attributes are used in different structural locations within a document and those elements are identical or similar. This can impact on code readability and comprehension and impact negatively on subsequent document creation and maintenance. Conversely, unique element and attribute names can improve understanding of document semantics.

Requirement

Do not define element names that are the same or similar to each other for use within the same document and use these defined elements for their originally defined purpose only.

Techniques

This element <amount> has two different semantic uses in this document and is said to be "overloaded". To correct this the second instance of this element should be changed to <quantity> to satisfy this requirement.


<excursion>
   <payment>
      <amount>5</amount>
      <unit>dollars</unit>
   </payment>
   <description>
      <item>packaged lunch</item>
      <amount>28</amount>
   </description>
</excursion>

Information Source

The original source of this information is located on the W3C web site  (www.w3.org/TR/xag#cp2_8)

 

Back to top