by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)


When to Use String Datatypes

It's amazing to think that despite all the complex applications that have been made possible by SGML and XML, whitespace processing—which seems as if it should be simple—has remained a nightmare for users and programmers. The string datatype will expose you to all the issues related to whitespace handling. A huge number of users and applications will modify whitespace in your documents to meet their expectations, which can make your documents invalid.

The token datatype keeps this nightmare from creating problems, and that is why RELAX NG uses token as its default datatype. Keep in mind that you shouldn't use the string datatype unless you have a good reason to do so. If whitespace is genuinely significant to your information, use the string type; otherwise, use the token type.


This text is released under the Free Software Foundation GFDL.