Hacker News new | ask | show | jobs
by hvidgaard 3798 days ago
It isn't much different from namespaces in programming languages, which most developers do not have a problem understanding.

They are in XML to avoid naming clash, and they do that well. I haven't really seen a different mechanic to solve that problem.

2 comments

I think the problem with xml namespaces enters in a few ways:

  - Non XML namespace supporting parsers: these are xml parsers people throw together without paying attention to the fact that attributes starting with "xml" are special and *must* be rejected.
      - This results in people trying to shim namespaces in after the fact; which rarely goes well.
  - There are two syntaxes: `<foo xmlns="urn:example"/>` vs `<myns:foo xmlns:myns="urn:example"/>`. Most people get caught up in the latter without understanding it, and you end up with *lots* of implementations that depend on `myns`, which is meant to be arbitary and can change between serialisation/deserialisation
  - The W3C style for namespace inheritence forces each element to keep a reference to it's parent: a nightmare for simple data structures.
The concept of namespaces in XML is fine, but the implementation... there's an awful lot of twiddly options and details and implementation/API quirks that come up. Throw stuff like XPath and XSD schemas into the mix, and the pitfalls multiply.