Attribute Types

So far, I've used just the CDATA attribute type when declaring attributes—and, in fact, that's probably the most common declaration type for attributes because it allows you to use simple text for the attribute's value. However, you can specify a number of different attribute types, and I'll take a look at them here. These types are not (not yet, anyway) detailed enough to indicate specific data types such as float, int, or double, but they can provide you with some ability to check the syntax of a document.


The most simple attribute type you can have is CDATA, which is simple character data. That means the attribute may be set to a value which is any string of text, as long as the string does not contain markup. The requirement ...

Get Real World XML now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.