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>
Copyright © 2003 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “XML Schema” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de
back to top