Re:XML Can Give the Same Performance as JSON
by lmm on Thursday August 15, 2013 @12:46PM
(#6219060)
>I don't think you get what schemas are for. Schemas don't validate the content - they validate the structure and variable types. It doesn't magically make the data valid. It lets you make assumptions about how that data is structured.
In a typed language the very first stage of deserialization, the "turn this from a string into objects in my language" step, will do that for you "for free".
In an untyped language I guess it could be helpful, but again: it's almost always easier to write these sort of checks in a general purpose programming language than in XML schema.
>The advantage of a schema is that one schema can be used in multiple languages. Someone's Lua based embedded system can run the same schema as a Go program on a 32 CPU box.
If that's what you want there are more robust and performant approaches, e.g. thrift.
>You can give someone a well written schema, tell them "make your data like this, and run the validator when you open and save your XML". In this way, it's a free, one line (in most languages) structure sanity check.
Right, but that doesn't tell them what they think it means. It doesn't make the request valid.
In a typed language the very first stage of deserialization, the "turn this from a string into objects in my language" step, will do that for you "for free".
In an untyped language I guess it could be helpful, but again: it's almost always easier to write these sort of checks in a general purpose programming language than in XML schema.
>The advantage of a schema is that one schema can be used in multiple languages. Someone's Lua based embedded system can run the same schema as a Go program on a 32 CPU box.
If that's what you want there are more robust and performant approaches, e.g. thrift.
>You can give someone a well written schema, tell them "make your data like this, and run the validator when you open and save your XML". In this way, it's a free, one line (in most languages) structure sanity check.
Right, but that doesn't tell them what they think it means. It doesn't make the request valid.