UserPreferences

ContentAsElements


Examples using XML elements for content attributes

Consensus seems to be that no one really likes this idea. :)

See content, ElementsVsAttributes.

 <content>
   <type>text/plain</type>
   <language>en</language>
   <language>fr</language>
   <value>
      Then the maestro pulled a rabbit out of hat, saying voila. He had a certain je ne sais quois, how you say? I don't know what?
   </value>
 </content>
Comments

[AsbjornUlsberg, RefactorOk] Though it makes the exact same sence on a conceptual level as attributes, I dislike using elements for everything. When Echo is serialized in XML (which will be the main serialized language we'll see it in -- maybe even the only language) we shouldn't allow alternative syntaxes. If Echo should be "allowed" serialized in other languages, like e.g. Enamel (where there aren't any attributes), alternative syntax should of course exist, as long as the object model stays the same.

[KenMacLeod] The presentation of the alternate syntax isn't to suggest that multiple syntaxes are to be used, but just that that design decision hasn't been entirely nailed down yet. See "Attributes vs. Elements" in EchoExample.

[AsbjornUlsberg] Oh, so it was only to show how ugly it is? Well, then it's ok. ;)

[KenMacLeod] I kinda like element-only in many cases :) In this case, though, note that it's the only way to allow two languages to be applied. One can't do that with xml:lang.

[AsbjornUlsberg] If you like element-only, you probably like Enamel too. It's neat. But when dealing with XML, which has attributes, I think they should be used. Also, the multiple language-issue isn't much of an issue, is it? It's true what you write, but I don't think we need to offer ways to solve this "problem" in Echo. At least not in v1.0.