tags:

views:

1066

answers:

24

XML has its uses.

What is the worst abuse of XML that you have seen? What about XML made it so unsuitable for the task?

+15  A: 

Storing Images.

Especially as an array of numbers representing individual bytes.

http://thedailywtf.com/Articles/Oh,-XML.aspx

Kent Fredric
+1, though I'm guilty of this offense myself
Nifle
Yup. Why so surprised? But I'm only guilty of "Storing Images" not storing them as byte arrays as the link shows.
Nifle
yup. i've seen "<Data>65,98,16,24........................</Data>" before.
Epaga
Oh? What's wrong with SVG?
vartec
+14  A: 

People noting experience with the "XML Programming Language" on their CV. Instant round-file.

Andrew
Does this actually happens? OMG
Rodrigo
I even know people that program HTML, CSS and, yes, XHTML.
Ward Werbrouck
What you have to remember is that 10 years ago a lot of people had no idea how to use XML or what it was. Then people were trying to show that they could bring something new that might help a potential employer.
Kevin
Theres only one thing worse than people claiming they program in XML, and thats people who *actually* program in XML. See ANT for examples
Kent Fredric
I'm with Kent. Some xml writing is actually a lot like programming, spring configuration files sometimes are like this, and ant files for sure.
Pablo Fernandez
Round-File? Or round-house!
Mitch Wheat
ANT files, WPF, Silverlight, log4net, WCF, hibernate... when will the madness end!
Cameron MacFarland
+1 for keeping your company free from idiots.
Turing Complete
+18  A: 

Using it as a database, rewriting the file on every update/insert. See this all the time...

Ward Werbrouck
Wasn't a .NET blog engine originally written like this? dasBlog? BlogEngine.NET?
Chris
@Chris More than 95% of everything written in .Net is written like this. True story.
mattbasta
+7  A: 

On a government project

XML wrapped in XML wrapped in XML wrapped in XML

The data in the original XML was already 8 layers deep.

Black Cat
aieee!! The Madness!
Mitch Wheat
A: 

It always bugs me when I see people using a SAX parser when what they really need is a DOM parser.

dicroce
Odd - I've never seen it, but not infrequently see exactly the opposite - trying to use DOM for streaming input. (I'm not the downvote btw)
le dorfier
+1, this is a legitimate "abuse." The idea to use it for the file format could be sound -- but the way it's parsed and manipulated can be abused.
Nicholas Piasecki
Well, the new StAX parser in java gets around the crappy SAX interface and the fact that DOM means reading the whole thing into memory.
paulmurray
Funnily enough, I would claim that inverse is even more rampant; using DOM when what you need is something else (not necessarily SAX, could be Stax, XPath, xslt, data binding)
StaxMan
+1  A: 

There seems to be some sort of standardized XML file format used in Europe for storing bank transactions. I've seen a contest for writing a new XML parser that is able to parse those files (that are > 10 GiB in size) quicker than other approaches. At those file sizes I don't expect XML to be a very good choice of file format.

And another one that bites me regularly here: Some sort of Java object serialisation which seems to work with exactly three different tags: java, object and void. The rest is all done with two or three attributes and massive nesting.

Joey
Hmm, now I have an idea what this person was up to: http://stackoverflow.com/questions/754899/length-of-a-xml-file/754926#754926 "I have an XML file of size 31 GB. I need to find the total number of lines in that file. .."
Dana the Sane
+3  A: 

On an inter-department government project where we had to send data to them. They'd heard that xml was the way of the future so they switched over.

They kept saying that our xml wouldn't parse properly. We looked at the data we were producing and it was valid xml, so we asked what the problem was.

Turns out they had written their own parser, which was counting whitespace, and we had too much whitespace in our xml.

Cameron MacFarland
+2  A: 

Using it for tiny amounts of data.

Philluminati
... or for big data stores
Javier
A: 

apache configuration file

Pablo Fernandez
Especially since it's this weird sometimes XML-like, sometimes INI-like, sometimes +what -were +theyThinking type of file format!
Nicholas Piasecki
+4  A: 

Pretty much everything that's written in Java abuses it, or abuses the users by using it as a format for configuration files.

Vasil
Not only Java. .NET is hardly less guilty at least for the config file format.
Joey
True, but I don't use windows very often so that doesn't bother me much.
Vasil
+10  A: 

Any sort of configuration file:

What I think is most disturbing about the whole concept of XML is that it is used for configuration when it seems that its focus was more as a data format for parsing documents. I absolutely detest having to write so much of it to configure anything these days. You can probably tell I'm coming at it from a Java background, but when I see examples in YAML, JSON, or even in a DSL, I wish XML hadn't ever become popular before people looked for more serious alternatives. XML is not readable, at least not at all in comparison to these alternatives, and I wish some serious clout was pushed to make XML less dominant.

Nick Klauer
I generally agree. The one time an XML configuration system was useful to me was in a horrendous build process where I could use XSLT to merge config sections from various sources into one big honking config file by the end of the build. In general, though, I miss the simplicity of good ol' INI.
Nicholas Piasecki
I absolutely agree. The verbosity of XML does nothing to improve how configuration is stored, but does plenty to add unnecessary complexity.
MattK
This answer says the God's truth.
Alex. S.
Is having multiple configuration formats for all the products you use in a single solution really that much better? A standard (as any compromise) is, by definition, something everyone is a bit disappointed in.
Pontus Gagge
I wholeheartedly agree. Describing a non-trivial build process in Ant is a pain, even though Ant has quite extensive and useful task library. Same for the Spring configurations, I see no benefit in using XML instead of plain Java to describe bean wiring and what else.
javashlook
+5  A: 

XMPP is pretty egregious IMHO, because it encodes an entire communication session as a single XML document. As a result, not only are DOM-based APIs useless in implementing XMPP apps (though to some folks, I'm sure that's a feature), but even SAX is problematic in the absence of multi-threading.

I implemented a Jabber client years ago in just such an environment (single-threaded, using SAX APIs); I had to make modifications to the parser to get control back to the application level when the socket returned no more data.

Dan Breslau
Part of the problem is that event-based (SAX) paradigm (as well as tree models, DOM) is ill-suited for streaming content. "Pull" (stax) parsers are better fit.XMPP has other problems tho, if I remember correctly -- wasn't it also abusing namespace definitions and such?
StaxMan
A: 

Fontconfig's configuration format. Seriously, who needs to learn some special XML syntax (pretty much a rewrite of XSTL) just to change antialiasing for some font sizes?

strager
+4  A: 

XML used to move data from tables in a relational database, into other tables in the same database, in the same application. Some of this data was also stored in text columns, with multiple values combined into a fixed column widths, memo-field style. Multi-valued columns built from multi-valued columns.

Someone else once stated: "XML is like violence. If it does not solve the problem, you are not use enough."

MattK
+5  A: 

People who knock XML - I think - don't realise how horrific life was before it. Every time you wanted to exchange data, you had to document in excruciating detail how it would be encoded into 80-column text. Usually the first ten columns or so would be metadata.

Then both parties would have to write code for it.

Proper use of XML and schemas is pages and pages of code that you don't have to write, test, and debug.

Beats me why people resent it when it's used to hold config data. It's often a great way to do the job. I think that what's happening here is that the config itself is a pain in the rear, and people are mistakenly thinking that it's XML that's the problem.

What the world needs is a good XML editor that understands schemas and CSS. The main pain relating to XML is having to edit it with a plain txt editor.

paulmurray
I can't see how XML is any better for communication that CSV - all you need is a doc (schema) that specifies what values are in which columns. Ant it's much easier to edit in simple text editors...
Paulius Maruška
From my experience, XML works well as an interchange format. Problems start when people start using it for everything else, like build files, configuration files, as a database etc.
javashlook
@paulius - try implementing a tree structure with CSV
anon
@paulius - Object serialization / deserialization is another great example. Passing objects between apps and a large number of languages has serializers built in. Your data lives in a POJO/POCO/PO*O and XML becomes 100% transparent if the serializer does the work.
joseph.ferris
I've done lots of integration, and to me flat files (fixed width) are quicker to understand and easier to get right.
WW
Too often I see "Let's use XML" as the default answer; it often isn't. XML is great if you have some really complicated nested data that you want to represent relatively quickly and easily; it's overkill if you just have 15 key=value pairs.
Adam Jaskiewicz
What is the worst abuse of xml that you have seen?
Ralph
A: 

Marketing. Thinking that saying "We make Java + XML" is enough to get some paying customers.

stesch
The real WTF is that they're often right...
Adam Jaskiewicz
+2  A: 

Using SOAP to transport an XML document, that has just one node containing encoded data, which when decoded gives you a one-level deep XML of name-value pairs.

Seriously. I've dealt with this in a API I've had to consume.

Rakesh Pai
+6  A: 

Writing your own XML parser, a sin of which I've been guilty in the past.

anon
Oh yeah and me too
thomasrutter
A: 

Using XML to describe UIs maybe isn't the worst abuse there is, but it is still pretty bad.

I don't see a point in introducing a new language (and each XML schema is effectively a new language, with specific tags and attributes you'll have to learn), to do the job that, say, plain old Java is quite capable of doing. Furthermore, when coding in Java (or any regular programming language), you have access to standard programming constructs, like ifs and loops, and ability to call methods, create factories for common constructs etc. Along with all other benefits from your IDE like call hierarchy, finding uses of method in workspace etc.

This is applicable, in my opinion, for both desktop and Web environments. For example, in JSP, you start by using XHTML to define your Web page interface... only to realize that you need conditionals and loops after all, and maybe some additional programming logic. So then people add new tags, like c:if, c:forEach, and an "expression language", so you end up programming in XML, with this awkward constructs, that have to be introduced as "tag libraries". The more I think about it, more awful it looks :)

javashlook
As far as UIs go, XML (WPF in my case) may not be perfect for the task but it's definitely a huge leap forward from things like Spring. Having to write a nested structure in linear code yields unmaintainable code at best.
Joey
For the FSMs sake what do you need control statements in GUIs for? No, please don't say "if (buttons.Count > 5) { this.ButtonSeparation -= 8; }".I'm SO GLAD that WPF / XAML finally separated the view design from code, everything else is terrible RAD - victim - style. Not software development.
Turing Complete
@Turing Complete: You can separate your view code from your business code without introducing a whole new language in the process. It is called MVC. What is the problem with having one set of Java files that build the UI, and a separate set of Java files, in another package/project/wherever, that deal with the domain/database etc. As for the usage of control statements, the problem is more pronounced on Web then on Desktop, but still, why do you think JSTL has c:if, c:forEach and other control tags? I don't do C# so I don't know the exact situation in that area...
javashlook
Having to design a GUI in code is part of the problem, javashlook. Have a look at WPF, when done correctly (not by former VB 6.0 - "developers"). There is not a single line of code behind, everything (including event handling!) is done via declarative syntax and data binding.I think it's most important that we all understand that the days of imperative programming are counted. The declarative age has begun, lets get rid of all this imperative timesinks.
Turing Complete
It seems to me we're talking past each other. What is the exact benefit of using declarative syntax if it is as verbose, or even more verbose than equivalent Java code? Maybe WPF does better job then various Java frameworks, I don't know. Yet, after years of pushing JSP, in the Java world there are now many frameworks that resort to Java-only approach (Wicket, Vaadin, Eclipse RAP, GWT). It seems declarative approach is the new thing in .NET world, though. Good luck with that ;)
javashlook
A: 

the XML produced/used by Microsoft Integration Services packages. Hundred/thousand of lines of code - in one single line.

no_one
+1  A: 

Processing XML with something else than XSLT.

I have seen too many DOM-based spaghetti-like programs that nobody, including their authors can understand.

People will greatly benefit just to know about the identity transformation as a general and most useful design pattern for processing (XML) trees.

Dimitre Novatchev
Is there a way of telling XSLT to invoke external code in a template? *that* would be handy.
paulmurray
@paulmurray Yes -- <xsl:call-template/>, <xsl:apply-templates/>, extension functions/objects. There are some nice *libraries* of XSLT templates/functions, such as FXSL or FunctX.
Dimitre Novatchev
+1  A: 

Some "developer" doing this (and no, this was NOT the funny joke someone made here about XML, this guy was for real):

<binary>
  <byte i="1">123</byte>
  <byte i="2">99</byte>
  etc...
</binary>

I think I even had a red face from anger when I saw that. People like this should simply get fired instantly.

Turing Complete
From the folks that brought you boolean values in VARCHAR db columns comes an all-new nightmare! XBC: eXtensible Binary Clusterfuck!
mattbasta
I love the saying "xml is like violence - if it doesn't solve your problem, you are not using enough of it".Well, main problem in our business isn't incompentence, but lack of motivation. "Morts", you know... the guys that are happy to close the IDE at the same time every late afternoon and then going home to watch TV. It's them who are responsible for the bugs, the refactoring sessions and feature abuse.
Turing Complete
A: 

XAML.

XML is not, and should never be, a programming language.

Cameron MacFarland