Tag Archives: xml

“Default namespace”

So if I have to getting pissed on something this week that would be default namespace “feature” of XML. Why? Because sometimes XML documents uses them but not declaring it properly, or they use it but gives no URI and they rely on targetNamespace.

Note that the least ethical way to declare a default namespace is to write xmlns=”{YOUR_URI_HERE}”, you can’t just replace it with targetNamespace attribute. It serves different purpose, and doing that intentionally is not even funny!

It just doesn’t make sense, if the point is to minimize size why not using some sort of compression? Well I know libxml2 can compress XML document ‘on the way out’ (eg. saving it to file, for another I/O, etc.). Besides, it is not that difficult to use compression like (let’s say..) Zlib, since there’s a lot of port/binding to it for God-knows-what programming language you use. Sure it turns your XML to binary, but you can just un-compress it on the other end; just because its XML it doesn’t say that it has to be ‘text’ all the time.

Just because you can churn out that crap and “it works” on your development environment or where you are working, doesn’t mean that everybody else can use it right away. I mean, that’s the reason why we have standards right?

If it was for me to decide, I’ll force everyone to follow the proper way to declare any namespaces, and the hell with saving some bytes. The only case of default namespace is (X)HTML, I make it an exception because it seems back in the days where HTML were new they have slow network connection.

Now that we have broadband internet (or at least 56Kbps over the phone line), and nobody uses 9600 baud modems over the internet anymore, so stop doing that!! The amount of extra bytes is moot compared to yet another complexity that doesn’t exists in the first place if everybody use the proper way to do it.

I’m sorry for all that, I was pissed because I have to come out with some XPath statements (well basically a program) to parse WSDL files and how it was created is clearly not something that I can control. More lines, more code.. yeah, this stupid thing sucks.



Leave a comment

Filed under Pendapat gak penting, Uncategorized