Hacker News new | ask | show | jobs
by arethuza 5479 days ago
If that is the worst XML that you have experienced then you have been very very lucky. I've seen stuff that:

- Has been built by string manipulation and therefore isn't well formed and needs hacky preprocessing before being parsed (no not HTML)

- Is full of redundant information (e.g. count attributes giving the number of child elements)

- Makes evil use of vast numbers of namespaces where the element names are all the same

- Is a basically a container for delimited or fixed format data

- Had attributes that contained entire encoded XML documents

<sob>

There are probably some other horrors that therapy and/or alchohol have let me forget (like systems doing SQL queries doing string compares on lumps of XML).

I really like JSON these days...

3 comments

> - Had attributes that contained entire encoded XML documents

I've got that beat. I've dealt with XML that was basically a wrapper for JSON, which contained - you know where this is going - an XML string.

It's retarded elephants all the way down.

This is getting downright Yorkshiremenesque.
Had to look that one up before dispensing an upvote.
Notice the "encoded" - they were (if I recall correctly) base64 encoded XML documents...
Hm. I never heard of XJsonX, but it would be a trivial logical extension of JsonX (http://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/inde...)
I've seen CDATA elements that contained complete XML documents including other CDATA elements. Good thing they had a hand rolled non-standard XML parser that allowed nested CDATA tags.

I noticed it when I wanted to read the doc in with tinyXML while working 70 hour weeks to fix up some other issue before a deadline. I ended up doing a memset(nestedXMLStart, ' ', nestedXMLLength) as a preprocessing step to bulldoze the whole construct. Not pretty, but it worked.

Two words: external references [1].

XML is a data representation that desperately wants to be Turing complete through syntax.

And then they call their schema definition language (because defining XML schema is practical by using a specialized language) RELAX...

You can't make this stuff up.

[1|http://books.xmlschemata.org/relaxng/relax-CHP-10-SECT-1.htm...]