3 ms·
i think a major problem is that XML kinda looks and feels like HTML (and there was the whole XHTML thing to further confuse), and outputting HTML programmatical
by nrser 10y ago
i think a major problem is that XML kinda looks and feels like HTML (and there was the whole XHTML thing to further confuse), and outputting HTML programmatically (vs string / print / template based) has most been frowned on as overweight and cumbersome.
you come from web dev doing HTML like that and you see XML and think "hey, that looks the same, i'll do it in the same way".
XML is a programmatic data exchange format like JSON or YAML, which most people would never think of outputting as templates or printed text, but it looks and feels like HTML, which most people deal with first and where that's the standard approach.
- ams6110 10y ago>YAML, which most people would never think of outputting as templates Don't tell the Ansible folks!
- geerlingguy 10y agoAnsible uses Jinja2 to output templates in whatever format is preferred by the thing being configured. I haven't personally seen Ansible used to output YAML... But people will do anything :-P Ansible does use YAML as a configuration language though—something for which it's perfectly suited.
- spdionis 10y agoWell, some frameworks use yaml for config files and you might use ansible to write those. That said the templating is usually trivial, just maybe write some string values.
- cytzol 10y agoI’ve done it. It’s painful enough that it teaches you “don’t do this!”. For example, you need to escape `{{ item }}` as `{{ "{{" }} item {{ "}}" }}`!
- flomo 10y agoOutputting JS as templates or printed text was pretty common before every language added a handy toJson method though.
- nrser 10y agoyeah, I guess I sorta missed that... I mean the 'X' in AJAX was for XML... I've def been guilty of outputting "XML" with php tags. by the time we got to JSON there were libs available, or maybe we just wrote our own.