Hacker News new | ask | show | jobs
by _ZeD_ 4092 days ago
the problems with xml (as in "outside the XML-RPC, XMLSchema, XSLT, SOAP stuff") IMHO arises these two / three points

* it's a little too verbose (<xml></xml>.. while even S-expressions use just ')' as terminator)

* there is no obvious way to transform any xml to an object (pojo is the best aproxymation, but how do you differentiate between a sub-tag, a text node, and an attribute?)

* it's essentially typeless (how do you serialize a number? how to differentiate it from a string? from a boolean?)

1 comments

I agree that it is verbose, but I am not convinced that S-expressions are the solution. In a complex, deeply nested XML document, you should be able to tell where a given tag is inserted without counting parentheses.

> there is no obvious way to transform any xml to an object (pojo is the best aproxymation, but how do you differentiate between a sub-tag, a text node, and an attribute?)

That's OK. Just don't use XML to serialize data structures. IMHO, the use cases at which it is good are a lot closer to use cases for which HTML works than when you hesitate between XML and JSON.

> it's essentially typeless (how do you serialize a number? how to differentiate it from a string? from a boolean?)

That's not entirely wrong, but you can enforce a lot of things via XML schemas (eg, something like XSD or RelaxNG).

> you can enforce a lot of things via XML schemas (eg, something like XSD or RelaxNG).

XML is structured text that can be validated. XML's biggest selling point!