News for hackers. Stuff that matters.
Re:Traff: An open source format/service for live road traffi... by cbolat on Thursday October 20, 2022 @07:39AM (#33273172)
Honestly, why XML? Isn't JSON 100 times better, smaller and easy to use than XML? why choose a legacy format (with known security problems in parsers, compability, and unnecessary use of bandwidth) in 2022?
Re:Traff: An open source format/service for live road traffi... by alexchamberlain on Thursday October 20, 2022 @07:48AM (#33273234)
It looks like the primary implementation is in Java, which is still all about SOAP services and XSDs.
Re:Traff: An open source format/service for live road traffi... by rschoultz on Thursday October 20, 2022 @09:20AM (#33274274)
We are on Java 19 now. Several that spits out the same sentiment as you seem to be stuck with Java 8 and EE legacy projects from 2012.
Re:Traff: An open source format/service for live road traffi... by magicalhippo on Thursday October 20, 2022 @07:52AM (#33273275)
Tooling around JSON schema is lacking. For example, we have a fairly simple XSD which still requires the latest JSON schema version due to a choice element (IIRC), which Swagger doesn't fully support yet.
Re:Traff: An open source format/service for live road traffi... by jillesvangurp on Thursday October 20, 2022 @09:25AM (#33274351)
I think the reason is that mostly people don't define schemas for their json to begin with.

Back when xml was still commonly used, xml schemas were optional as well. The notion of insisting on adding longish urls to every attribute and namespacing elements and attributes, kind of defeated the purpose of using xml. It made everything harder; including parsing, xsl transformations, xpath expressions, etc.

Re:Traff: An open source format/service for live road traffi... by HyperSane on Thursday October 27, 2022 @11:56AM (#33359511)
"adding longish urls to every attribute and namespacing elements and attributes"

Who thought this was a good idea?

Re:Traff: An open source format/service for live road traffi... by berkes on Thursday October 20, 2022 @08:01AM (#33273357)
> Isn't JSON 100 times better, smaller and easy to use than XML?

Quite certainly not. It's not even more popular if HTML is included.

It may be smaller, but not nessecarily so: both json and XML are easy to compress due to repetitive (overhead) characters. Uncompressed it depends on the use-case and implementation: the ability to have both attributes and content on a node, allow (but certainly not always are) XML to be smaller than JSON which does not have this.

Easy to use depends on the features: JSON is gaining complexity rapidly (json-ld, json-templates, jsonschemas etc) to fill up what XML can do OOTB. Sure: an all-out XML (XMLT, DTD, etc) is far more complex than a simple JSON. But hardly more than a JSON with JSTL, JSon-schema etc. The exact same performance and security problems arise in JSON with all these features bolted on.

In other words: "it depends". But the idea that "JSON is 100x better" is repeated oft in the tech scene, yet impossible to back up in general. JSON may certainly be better for your case. But so can XML.

Re:Traff: An open source format/service for live road traffi... by hk__2 on Thursday October 20, 2022 @08:35AM (#33273674)
> Quite certainly not. It's not even more popular if HTML is included.

Nowadays HTML is not XML anymore [1].

[1]: https://stackoverflow.com/a/39560454/735926

Re:Traff: An open source format/service for live road traffi... by sirsinsalot on Thursday October 20, 2022 @02:22PM (#33278649)
What?! You mean everyone is just endlessly reinventing the wheel? You mean they start out simple then quickly realise much of the complexity of the prior is useful?!

Well I never!

Re:Traff: An open source format/service for live road traffi... by berkes on Friday October 21, 2022 @03:06AM (#33285337)
I wouldn't call JSON a reinvented wheel. It has different tradeoffs, and so fills a real niche that XML couldn't.

However, we, the engineering community tend to fall in this hammer-nail mindset. Where we know and like JSON, and then start applying it outside of its fitting niche.

We start using it for configuration (only to find out it's lack of features such as not allowing comments makes it fully unusable).

We invent stuff like symlinks, linked data, schemas, JSLT, etc. rather than moving to a much more appropriate format, we change the inappropriate format into an abomination.

Re:Traff: An open source format/service for live road traffi... by huggingmouth on Thursday October 20, 2022 @08:10AM (#33273443)
While i prefer json, I absolutly would not consider xml a legacy format.
Re:Traff: An open source format/service for live road traffi... by kybernetyk on Thursday October 20, 2022 @08:23AM (#33273560)
Json is terribly unstructured
Re:Traff: An open source format/service for live road traffi... by dewey on Thursday October 20, 2022 @09:12AM (#33274173)
There's https://json-schema.org for that.
Re:Traff: An open source format/service for live road traffi... by hokkos on Thursday October 20, 2022 @09:08AM (#33274116)
With EXI encoding the format XML is many times smaller than Json, it can uses XSD to have a scheme aware compression, and it is better structured with XSD.

https://www.w3.org/TR/exi/

Re:Traff: An open source format/service for live road traffi... by thibaut_barrere on Thursday October 20, 2022 @09:09AM (#33274136)
Maybe because other standards (https://www.datex2.eu/datex2/about) in the same area are also XML based, I wonder :-)