Objects don't fit XML very well
-
Complex types and simple types
Simple types were supposed to make life simpler, but it turns out that if you add an attribute to an element, you need to change it from a simple type to a complex type - which is substantial syntactic and semantic work unless you've buried the details under tools.
-
XML is labeled structure
XML came with a deliberately weak notion of type. It maps well to loosely-typed languages like Perl or Python, in which a named container can hold whatever kind of information its creator deems appropriate. It maps pretty poorly to languages like C++, C#, or Java, where all type information must be known in advance.
-
Order matters
Objects don't care about the order of methods or properties. Except in a few special cases (arrays, collections), things are referenced by name. In XML, order generally matters, with the sole exception of attributes. This makes extending and restricting XML structures much trickier than extending or restricting objects.
-
Different kinds of hierarchies
While XML is itself hierarchical, it's a a very different kind of hierarchy from an object hierarchy. Objects don't tend to have odd bits of text stuffed between them, while 'mixed content' is a feature - not a bug - of XML.
-
Context
W3C XML Schema lets you do unusual things with meanings that vary in different contexts, especially on things like "local" (non-namespaced) content and "chameleon schemas".
Previous Page <
TOC
> Next Page