Some XML "Best Practices"

I'm not much of an XML guru but here are a few XML "best practices" that I follow in my day-to-day work with XML:

Use the most strict document type available. Favor well-formed over not well-formed.  Formed valid over well-formed.  Favor strict schemas over relaxed schemas.  Favor expressive schemas about the semantics of the document over simple schemas only about the structure.

Validate, validate, validate. Ensure the documents refer to a schema (or DTD) for validation. Use editors that constantly check for validation.  Use build tools that check for validation.  When validation errors occur, address them promptly.

Use the schema types effectively.  Watch out for types that are unbounded (integers, strings, etc.) or inappropriately bounded relative to the use (integer range 0000-9999 used to represent a year).  Favor compositing types in schemas so that types can be re-used and have a consistent syntax and semantics across documents.

For more, see the references in my list at

- Brian

No comments: