Gosyx vs spurious XML

Juan Andrés Hurtado Baeza
LAI4D
Published in
3 min readJan 8, 2018

LAI4D drawings are written in Lai4dCL, which is one of the simplest text based drawing formats, and much more comfortable than XML based formats. Lai4dCL is a structured language thanks to the Gosyx syntax. Other simplified syntax similar to it already exist and could have been used for the same purpose, but Gosyx and its API were already developed and tested for an old project so they have been finally included in the Iquix framework.

The election of Gosyx as the syntax for describing data structures has been the result of a complex decision. It has been complex because, apparently, any application in the universe that needs to handle data structures as text files must use XML, even more if the application is intended for the Internet. There is no doubt at all about the XML capability for describing data structures, but the experience has demonstrated that XML is a syntax uncomfortable for direct user edition and anti-economic for describing certain types of data structures. Clear examples of that are some of the most popular formats used for describing geometric information such as SVG, VML or X3D. This geometric information is mainly composed by coordinates, normally packed in groups of two or three items. When a geometric entity is defined by a known number of data items, segments or circles for instance, XML offers the possibility of using named attributes for structuring them as the “economic option”. However, when the geometric entity is defined by an unknown number of data items, polygonal lines for instance, XML does not offer any economic option for structuring them. This is so true that those popular formats have completely renounced to the XML syntax in such cases and the data structuring is achieved by means of an invented custom syntax embedded in the standard XML syntax. Here is an example of a SVG line element:

<line x1="20" y1="100" x2="100" y2="100" stroke-width="2" stroke="black"/>

This element is defined by two points of two coordinates each one, therefore they can be structured as standard XML attributes. Find next an example of a SVG polyline element:

<polyline fill="none" stroke="black" points="20,100 40,60 70,80 100,20"/>

Polyline elements can have an undefined number of points. In this case SVG structures the coordinates in a string using commas and spaces, what has nothing to do with XML syntax. The result is a spurious use of XML because the data items are not actually structured using XML syntax but other one created ad hoc. This strategy, although valid, not only increases the number of syntactic rules, but also forces the developers to implement new parsing procedures for managing those data items increasing the complexity of the code too. HTML is another popular format, not directly related to geometry, plenty of examples of the previously mentioned spurious XML.

After considering the problems of the XML syntax and after not having found any real advantage in XML compared to Gosyx, the use of XML based formats has been finally rejected in favor of Gosyx which is simpler for development and more comfortable for direct user edition. While in most modern applications the direct source edition has been deprecated or even made unavailable in favor of the graphic interface, in LAI4D it is considered an important alternative because it requires a minimum learning effort when the source edition strategy is well designed. The big concern is the fact that the rest of the world does use XML, but this is a sacrifice to be assumed. Anyway current web pages already are an accepted mixture of different syntax like the one used for HTML, the one used for CSS, the one used for JavaScript or the one used for WebGL programs; why not to use another one if it has clear advantages?

Keep informed of LAI4D news

--

--

Juan Andrés Hurtado Baeza
LAI4D
Editor for

Founder of the Laboratory of Artificial Intelligence for Design (www.lai4d.org)