Are You an XML Bozo?

Here's a helpful article that documents some common pitfalls to avoid when composing XML documents. Nobody wants to be called an XML Bozo by Tim Bray, the co-editor of the XML specification, right?


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2006/07/are-you-an-xml-bozo.html

I only have occasional need to deal with XML at present so might well be an unwitting Bozo. But many of these rules expressed as Donā€™ts leave questions begging. For example, #5 if you donā€™t use an XML parser what do you use?

I on the other hand love xslt :). Iā€™ve yet to run into a problem that requires an impractical solution. And with grouping, regexp and all the goodies of xpath 2.0 itā€™s even easier to use.
I have rule nr. 1 taped on the wall behind my desk. Whenever someone comes in with an xml-related issue I simply point to the poster. This is usually all it takes :).

Talking of bozos, #17: Can we find the person who came up with the term ā€œastral planeā€ and beat them to death with their own dungeons and dragons books? Please?

If you need that many rules to get your document format right, you might want to think about a different format.

XSLT haha!

When I first joined this organisation that used an XML database called Tamino that then used XSL files to create webpages, along with the help of some Java.

The whole system was massive, complex and bloody slow.

I re-developed the whole thing using SQL Server 2000 and asp.net pages. It uses a fraction of the size, runs much faster and its very easy to make changes, unlike the XSL system :yuck:

Jeff, it should be noted that using XSLT will (prettymuch) guarantee that your output will be conformant to all of those rules for generating XML.

So although on one hand you say ā€œXSLT is insaneā€, on the other hand this entire post seems to be an argument in favour of it.

I would like to add a question to that list - Does this problem really require XML ? (Think Ant).

Hereā€™s a good list of things to consider when writing XML:

a href="http://recycledknowledge.blogspot.com/2006/03/writing-out-xml.html"http://recycledknowledge.blogspot.com/2006/03/writing-out-xml.html/a

And when converting HTML to XHTML

a href="http://recycledknowledge.blogspot.com/2006/03/how-to-write-xhtml-even-if-you-dont.html"http://recycledknowledge.blogspot.com/2006/03/how-to-write-xhtml-even-if-you-dont.html/a

you obviously are not a good xslt programmer.

And of course he recommendsā€¦ the serializer/XmlWriter! Yes, letā€™s all write at least 3 lines of code for every element, more if there are attributes!

I donā€™t have a problem with XML, but the notion that itā€™s perfectly okay to expect developers to write 500 lines of code comprising 46 routines and 13 classes just to spawn a single document sounds characteristic of an Architecture Astronaut.

Maybe text-based templates arenā€™t the answer either, but you can use a single routine to escape a full XML string without the ridiculous overhead of a ā€œwriterā€. IMO, in order for XML to really be productive for developers, the dev tools either have to serialize it automatically (.NET Web Services), or allow it to be written ā€œnativelyā€ (Ruby / XLinq). Without simplified support, Iā€™d have to ask if the same problem could be solved with plain-text/CSV or an RDBMS.

Liquid XML Studio is a free XML Editor and graphical schema editor for windows, it provides ā€˜Well Formedā€™ checking and validation against external XML Schemas. It also has an XSLT editor which can execute the transform and show the results.
http://www.liquid-technologies.com/XmlStudio/Free-Xml-Editor.aspx

ā€œXML: The Angle Bracket Taxā€ should be a link pointing to

https://blog.codinghorror.com/xml-the-angle-bracket-tax/

1 Like