4 ms·
XML is well structured, typed and general purpose, but it's a pain for humans to edit. I think the editing pain is one of the main reasons people look for XML a
by nielsbot 3y ago
XML is well structured, typed and general purpose, but it's a pain for humans to edit. I think the editing pain is one of the main reasons people look for XML alternatives. Personally I wish XML was written a lot more like HAML.
- d-lisp 3y agoXML -> human editable format -> XML I am searching for this, any clue ?
- kaba0 3y agoXML -> a not-piece-of-shit IDE/text editor -> XML
- d-lisp 3y agoThis is fine for me, but I cannot force others to do the same, I use emacs, have good eyes and ability to parse XML; now most of people I work with use less than ideal IDEs.
- emmelaich 3y agoAugeas. And other data formats. However, before you start, there were bugs that I found, and Augeas is a bit hard to work with.
- speed_spread 3y agoCheckout KDL
- matsemann 3y agoAt least I've never had production errors because of malformed xml. Yaml, though.. A misplaced dash and your list of a single item is suddenly two distinct items instead.
- nikanj 3y agoMalformed xml sneaks through the kitchen window and poisons you in your sleep. Someone puts naively escaped umlauts (ä -> ä ) into the surname field and your entire xml parser borks with unknown entity errors
- Groxx 3y agoWhile I definitely agree yaml is pointlessly prone to this ("NO" lol), I've had plenty of xml issues. Bad manual attribute encoding, duplicate attributes (pretty easy when there are lots) that vary in behavior depending on your xml reader, using text content instead of attributes, using lists of text nodes as a map that then gets deduplicated inconsistently instead of attributes (to work around needing to manually encode complex or multi-line text into an attribute)... Humans can screw up anything. And more text often allows it to hide for longer.
- kaba0 3y agoBut one of them has schema descriptions to prevent these errors as soon as possible.
- Groxx 3y agoSure, if you define and use it. Same as yaml schemas (they exist!). XML has them sorta built in (basically all (notable) libraries support them), but it's not like it's required or somehow innately protected because of that. It's just a bit easier to adopt.
- matsemann 3y agoBut my case was with a yaml validated to a schema. A kube ingress file with a list of rules. My additional dash made it a new entry, in practice allowing everything. With xml it would have been very explicit that I now accidentally had made two rules.
- throwawaymaths 3y ago> But one of them has schema descriptions JSONSchema? It's pretty standardized and well accepted.
- smarx007 3y agoXML is a data format for correct exchange of information between computer systems. Human-friendly editing was never the no 1 goal for its designers. And with good tools like IntelliJ IDEA, I have easier time editing pom.xml configurations than k8s YAML files, to be honest.
- PaulHoule 3y agoStructured editors have been around since the beginning of XML but they have been slow to catch on generally and have never been that popular because people don’t feel in control.
- NBJack 3y agoAh, kinda. Yes, they existed, but they frequently didn't have many of the more standard features like autocomplete (particularly on both sides of a new tag) and on-the-fly structure parsing that makes much of the painful parts easier to work with. I think we take for granted how good our modern approaches to IDE assistance can be. Ever use the earliest IDE incarnations of Eclipse on a PC still measured in hundreds of Mhz, or when RAM was still in the dozens of MB? That was the world XML found itself in during its inception.
- fiddlerwoaroof 3y agoElectric tags in emacs make it mostly not a problem, and most editors have some equivalent: ‘it’ and ‘at’ motions in vim as well as vim-surround and emmet. But, I agree that this is one of the worst parts of XML
- marcosdumay 3y ago> And with good tools like IntelliJ IDEA Nah, I have an easier time editing XML in a dumb text editor than YAML with the best tooling I've ever found for it. In fact, I have an easier time with any of its competitors people post around than with YAML. What is distressing, because the language has clearly the goal of being easy to write.
- tremon 3y agoI would rather say that XML is untyped (an XML document only contains text of various flavours), and that is why the only concrete example given works in XML but would fail in YAML or JSON: “test this against Go 1.20” > It interprets that as Go 1.2. Well, understand your data format before complaining. YAML, like JSON, understands data types. If you were to write { value: 1.20 } in JSON, it would similarly be interpreted as the numeric value 6/5. The only reason this works "magically" in XML is because XML itself doesn't have data types, it only has text, and the interpretation is left to the user rather than done by the parser.
- kaba0 3y agoXML schema definitely has types.
- tremon 3y agoNice, I wasn't aware of that. But it doesn't change the argument much: the XML document still only contains text data, and it's the schema validation phase that's responsible for converting the data into the correct format. Validating an XML document is an optional step, and I'm not aware of many tools that use XML as their config that perform full schema validation. To add, the XML specification on decimal data types [0] explicitly says: Precision is not reflected in this value space; the number 2.0 is not distinct from the number 2.00 -- so a decimal data type in an XML document would have the exact same problem as the YAML example in TFA; the only difference is that with XML, the authors of the tool would have to actively shoot themselves in the foot by annotating that element as a decimal type rather than text. [0] https://www.w3.org/TR/xmlschema11-2/#decimal https://www.w3.org/TR/xmlschema11-2/#decimal
- ImPostingOnHN 3y ago> the XML document still only contains text data this is like saying Java is untyped because the source files are just text
- 3y ago
- thechao 3y agoHAML reminds me of a "whitespace sensitive" ML we used that's 1:1 with XML: node @attr="bob saget" subnode @foo="john" subnode @ham="bar baz" html:h1 p $"this is literal text" It's ok.
- MathMonkeyMan 3y agoPut some parentheses in there and you're good to go :)
- thechao 3y agoIt's from a language called BOOT which is parenthesis-free Lisp!
- raydev 3y agoIf a majority of programming nerds weren't so averse to building UI to facilitate more complex actions with better guardrails, we'd probably be better off in many ways. Our desire to not standardize anything beyond "human readable ASCII-like" has held us back, imo. Xcode's plist editing ability is a mild improvement over manipulating XML text directly, but could use more obvious shortcuts/hotkeys. Even writing XML in an IDE like IntelliJ isn't great, autocomplete should do a lot more.
- eviks 3y agoWhy would you need text-like XML if you get a good tool that converts to a more useful data entry format? Wouldn't you just use more efficient binary encoding for storage/interchange, while converting to something user-UI-friendly?
- raydev 3y agoYeah, I agree, doesn't necessarily have to be XML. But adding a highly productive UI layer on top of existing standards would be a great start.