XML technologies / XML Schema / Documenting schemas / XML 1.0 comments

(Excerpt from “XML Schema” by Eric van der Vlist)

Recent XML vocabularies tend to use dedicated elements for documentation or metadata instead of general-purpose XML 1.0 comments or processing instructions. W3C XML Schema follows this trend with its elements xs:documentation and xs:appinfo. This choice is often justified by ease of use in applications and the fact that parsers need not pass comments to applications. In practice, most parsers do pass comments through, making them available and easily processed, even with XPath expressions. A better argument for elements is their ability to hold structured content.

On the other hand, XML 1.0 comments and processing instructions are lighter and can appear anywhere within any element, not just as the first child of XML Schema components. With an XML 1.0 comment, our example becomes:

<xs:element name="author" type="authorType">
  <!-- Dieses Element beschreibt den Autor eines Buches. -->
</xs:element>

   

 

 

 

back to top