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

Tags and White Space

Inside tags the white space story is quite different. These three shape elements are the same for all intents and purposes.

<shape>star</shape>

<shape
            >star</shape>

<shape    >star</shape>

Parsers will not distinguish one from the other, and your code should not depend on the difference.

Similarly, white space in a document's prolog, epilog, and DTD is not considered. For example, these three documents are essentially the same.

 <?xml version="1.0"?> <?xml-stylesheet type="text/css" href="root.css"?> <!DOCTYPE root SYSTEM "data.dtd"> <root> contents </root> ____________________________________________________________ <?xml version="1.0"?> <?xml-stylesheet type="text/css" href="root.css"?> <!DOCTYPE root SYSTEM "data.dtd"> ...

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