3 ms·
I am the only one who utterly despises namespaces in xml? Query a document with a namespace? Oh no results? Ah forgot to add the namespace... I had never a use
by HdS84 4y ago
I am the only one who utterly despises namespaces in xml?
Query a document with a namespace? Oh no results? Ah forgot to add the namespace...
I had never a use case for namespaces, and the ones I can envision would have been better served by a property or attribute.
- acdha 4y agoNamespaces are great as a concept: I can take your standard document and extend it without any chance of conflicting in the future if you later a property or element of the same name. This is really important for interchange systems since you inevitably end up with cases where a standard format has almost but not all of the vocabulary you need. Unfortunately, namespaces as implemented in most XML tools are terrible and that's 100% the fault of the implementers. The problem is basically this: <foo xmlns:bar="http://example.org/foobarspec"> <bar:a href="baaz">hello world</bar> <foo> To a human reading that, you should be able to write a selector like /foo/bar:a or even /foo/a but as an XML parser sees the world bar is actually: {http://example.org/foobarspec}a That's an implementation detail but a shocking percentage of XML library developers did not implement a lookup mechanism to resolve it when given "bar:a". I would maintain that paying a single developer to make libxml2 suck less would have done more to help XML adoption than everything done by any XML-related standards group combined after Y2K.
- PurpleRamen 4y agoFirst thing I do in any XML-Parser I write: search/replace the namespaces. I know this is awful and impacts speed, but namespaces are so f*** annoying to handle with most parsers. Getting rid of them is the simplest solution for my sanity.