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

Where to Stop?

At the absolute extreme I've seen it suggested (facetiously) that an integer such as 6587 should be written like this:

<integer>
  <thousands>6</thousands>
  <hundreds>5</hundreds>
  <tens>8</tens>
  <ones>7</ones>
</integer>

Obviously, this is going too far. It would be far more troublesome to process than a simple, unmarked-up number. After all, almost everyone who wants to use a number treats it as an atomic quantity rather than a composition of single digits. However, this does suggest a good rule of thumb for where to stop inserting tags. Anything that will normally be treated as a single atomic value should not be further divided by markup. However, if a value is composed of smaller parts that will need to be addressed individually, ...

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