O'Reilly logo

Effective XML: 50 Specific Ways to Improve Your XML by Elliotte Rusty Harold

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The xml:space Attribute

The xml:space attribute can indicate the significance (or lack thereof) of white space within a particular element. It has two legal values, default and preserve. The value default means that the application may treat white space in the element in whatever fashion is customary for that application. For instance, it might trim off or compress excess white space. The value preserve means that white space is significant, even if it normally isn't, and the application should not adjust the white space in any way.

For example, the xml:space attribute of the text element below indicates that white space is significant and should be preserved.

 <text xml:space="preserve"> I try to make XML lean Without extra white space between ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required