4 ms·
What kind of language and library makes creating an XML document is difficult? I know it's fashionable to hate XML, but seriously, it's a perfectly fine format,
by MichaelGG 14y ago
What kind of language and library makes creating an XML document is difficult? I know it's fashionable to hate XML, but seriously, it's a perfectly fine format, especially for serializing simple documents. The closing tags add some overhead; big deal.
I'm not even sure why much of a format was needed at all for this scenario. According to the docs[1], cURL will get a plaintext string, which has to be sufficient for nearly every implementation needing CNAM data. I'm quite sure I created a similar CNAM API in 2006: HTTP GET, return 200 OK and a string, or an HTTP error. Other major vendors' APIs are not difficult to work with, either (although contracts, VPNs, etc. can be annoying).
One reason there are more complicated APIs is for performance. While HTTP is simple, pipelining leaves a lot to be desired, and there is a benefit to being able to just use UDP.
As far as the data returned: I'm not even sure what an application supposed to do with a relative URI for a number after querying for that number? Or the price, which is apparently fixed per account? I cannot fathom why something as complicated as YAML would be needed to deal with such a simple situation: I'd wager customers asking for that are trying to be trendy or something, especially as JSON is a subset of YAML.
Not to be too negative -- OpenCNAM looks like the kind of thing telephony needs: easy, online signup, straightforward pricing.
1: https://www.opencnam.com/docs/v2/quickstart https://www.opencnam.com/docs/v2/quickstart
- masklinn 14y ago> What kind of language and library makes creating an XML document is difficult? Note that everything is relative. Taking Python, serializing any combination of "core" data structures with json is a single call (json.dump/json.dumps). XML? Well I could use XML-RPC serialization but nobody does that anymore, and so I've got to define my own serialization format with all the right conversions and shit.
- icebraining 14y agoXML is a mediocre format (the problem it solves is not hard, and it does not solve the problem well), but more importantly in this case, it's a format for serializing documents, and OP was trying to serialize objects. Obviously, we needs to add some core to perform the translation, though with any decent library it shouldn't take a full day.