XML Schema: FIXML and SVG

Time:2019-5-23


FIXML


FIX is one of the data exchange formats among many enterprises, which is used to exchange information in business activities. Such exchange of information is often important, such as exchange of transaction payment data, stock prices and business information.
The information that needs to be transmitted is sometimes very small packages and sometimes large pieces of data. The traditional format of this kind of information exchange is key/value pair, which is very inefficient. Using XML can simplify the structure of the data transferred, especially the complex data.
In an optimized version of XML, developers have managed to compress the size of data files while making the data easier to read. The stock data is compressed to a quarter of the size of the old format.
Except for typical commercial applications, FIXML is not suitable for other fields. But if using FIXML can improve business efficiency, the result is that everyone will benefit.
Scalable Vector Graphics (SVG) is an XML standard for describing drawing. SVG can be used to describe lines, shapes, positions and their relationships. The most attractive thing is that this information can be output in the desired format, including scalable graphics and fixed pictures.
SVG solves some important problems in traditional drawing process. It is usually done with a special drawing program. Sharing information and drawing between different programs is generally very difficult. Save as SVG means that any application that supports SVG can read and process these files.
Another problem with drawing is that when it is output to the most commonly used format (especially on the Web), it must be translated into bitmap format (such as JPEG or PNG) before it is displayed or combined with other documents. This traditional method has some problems. First, the original drawing must be explicitly (usually manually) exported into a bitmap format.
Secondly, since the bitmap format is based on the pixel-by-pixel representation of the original drawing, the size and resolution of the target matching must be carefully selected and output in order to ensure the quality of the image. For example, the resolution of screen display requires 72 DPI (or 96 dpi) to match the standard resolution of most monitors. Print output requires 300 to 2400 DPI. Therefore, the generated image file may be very large compared with the original file.
Although vector-based formats existed prior to PostScript and Encapsulated PostScript, CPU requirements were very high and were not suitable for screen display.
Like any other vector image format, SVG uses lists of various shapes to describe image content, rather than generating pixel representations. For example, the rectangle only needs to give the upper left corner as the starting point, plus the length of the two sides. The description of the image is expressed in XML. Labels include lines, rectangles, polygons, circles and so on, which can control the style and format of these elements.
Listing 9 gives an example. Here we draw a rectangle, a transparent circle and a triangle.
Listing 9. Simple graphics

<?xml version=”1.0″ standalone=”no”?>

<!DOCTYPE svg PUBLIC “-//W3C//DTD SVG 1.1//EN”

“http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd”>

<svg width=”100%” height=”100%” version=”1.1″

xmlns=”http://www.w3.org/2000/svg”>

<polygon

points=”200,100 300,200 150,250″

style=”fill:#cccccc;

stroke:#000000;stroke-width:1″/>

<rect x=”20″ y=”20″ width=”250″ height=”250″

style=”fill:blue;stroke:black;stroke-width:1;

fill-opacity:0.1;stroke-opacity:0.9″/>

<circle cx=”100″ cy=”50″ r=”40″ stroke=”red”

fill=”red” style=”fill-opacity:0.5″/>

</svg>

Figure 1 shows the bitmap of the generated image.
Figure 1. Bitmap version of an image
图像的位图版本

The file describing the image in SVG format is only more than 500 bytes, and PNG is close to 9 KB.
SVG makes drawing smaller, easier to use and more compatible with different applications.