[webservices] A question of location ID, how to represent empty IDs in XML?

Joachim Saul saul at gfz-potsdam.de
Fri Jul 25 06:26:52 PDT 2014


Hello Rob,

Rob Newman wrote on 24.07.2014 18:51:
> For what it's worth, I would also vote for the "--" standard. To quote from the Zen of Python <http://python.net/%7Egoodger/projects/pycon/2007/idiomatic/handout.html> (my language of choice):
>
> "Beautiful is better than ugly.
> Explicit is better than implicit.
> Simple is better than complex.
> Complex is better than complicated.
> Flat is better than nested.
> Sparse is better than dense.
> Readability counts.
> Special cases aren't special enough to break the rules.
> Although practicality beats purity.
> Errors should never pass silently.
> Unless explicitly silenced."

I'd add "Compatible is better than incompatible." :)

> Number 2 is especially relevant here:
> "Explicit is better than implicit."

My favorite would be:
"Special cases aren't special enough to break the rules."

> Quoted whitespace and nulls are painful. Code what you mean, and mean what you code. It's easier for everyone.

But what if we simply *mean* "empty string"?

The issue is not about beauty, pain or ease. It's about standard 
conformance. We already have a channel naming standard. If a new data 
format cannot accommodate existing channel naming, then the new format 
is flawed. But that's not even the case here...

An XML document that contains

<Channel locationCode="" ...

is not malformed. There's an attribute that *explicitly* contains an 
empty string and a parser has to produce it as such. Not as null, nil or 
none, but as an empty string. Otherwise the parser is broken and needs 
to be fixed, not the data!

Again: It's not about beauty. We all agree that current channel naming 
is not particularly beautiful and has limitations. But our business is 
not to try to solve that issue now and here.

Cheers
Joachim


More information about the webservices mailing list