What is the point in XML?

What problems was invented by XML to solve? From what I can say, it looks like it defines a single syntax for things that can have significantly different semantics. Unlike, for example, an HTML file, a Java source file, or a .docx document, it is impossible to write a program to extract any level of high-level value from an XML file without a lot of additional information. What is the value of syntax rigidly defined by some standards committee, even if the semantic meaning is not fully defined? What are the benefits of XML by simply flipping your own ad format that does exactly what you need and nothing more? In short, what does XML do and why is it so widely used?

+7
xml history file-format
source share
5 answers

XML forces your data to be well-structured, so a program that does not understand the semantics of your data can still understand its syntax. This allows you to use things like XSLT that transform one well-formed XML document into another. This means that you can manipulate data without having to interpret it. You can see that the document is well-formed and valid according to its DTD, without requiring an understanding of the content.

It was a huge step forward for data storage, compatibility, and machine readability in general.

+15
source share

I personally think XML is useful because I find that parsers are written as pain. If you come up with your own data format, it will lead to the fact that you will spend a lot of time analyzing the parsing code - checking the correctness of the input into what can be a lot of user data. Then, after you receive all the input and validation code for your parser, you will enjoy the development of documentation for your file format for anyone who wants to use it, as well as for the further joy of finding errors in your input validation code for your parser after they start sending data in your way.

With XML, the parsing mechanics are well defined, and with an XML schema or DTD, you can specify the formats that you are ready to accept. XML parsers are available for almost all major programming languages, so the amount of code you need to write, maintain and document is greatly reduced.

+7
source share

xml allows you to be the standard standard way :). It is ugly, it is verbose, it takes up a lot of space and is absolutely invaluable for interaction. Basically, xml is good because it gives you a standard way of describing your data, so that one type of parser can process data from different sources.

To use a more specific example, I worked in the semiconductor tool industry a few days before xml. Each tool used a recipe to describe how to process a particular plate. Each of these tools used a different format for its recipes. Now take pity on the poor man (me!), Who had to take several of these tools and integrate them into a single processing system. I had to write a different parser for each type of recipe, convert recipes from a common repository to a format suitable for a specific tool, it was just a nightmare. If xml was available, all of these recipes could be defined via xml and any conversions or conversions processed using simple xlst scripts. This would save me literally months of development efforts for just this part of the integration code.

+6
source share

Special solutions work perfectly well within your own system, but when you need the ability to communicate with 1 ... N other systems, this is a good foundation on which all parties can expect to work at least in a certain way. Yes, the data does not have semantic meaning, but you are sure that the TRANSFER and CONVERSION data will still be successful. There are many more reasons, but this is one of the most important that I always thought.

This is a very primitive example, but think about when systems are used to communicate with flatfile data. You might have had a string that other parties created a link, such as AAABBBCCCDDD . Other systems knew that they would receive AAA β€œdata” in the first three characters, etc. Now someone changes something and accidentally sends BBB AAA CCC DDD . Boom, everything is broken.

With XML, you can have both:

<xml> <a>AAA</a> <b>BBB</b> <c>CCC</c> <d>DDD</d> </xml> 

and

 <xml> <b>BBB</b> <a>AAA</a> <c>CCC</c> <d>DDD</d> </xml> 

without disrupting the operation of the elses system.

+4
source share

The answer to your question. "From what I can say, it looks like it defines a single syntax for things that can have completely different semantics." Having a uniform syntax solves part of the problem for things that have significantly different semantics, and this is not a trivial problem in the least.

Similarly, text encoding is used in markup (including XML), computer programs, writing human-readable documents, and many other tasks with significantly different semantics. Would you like to invent Unicode every time? Could you even know enough about all the problems to be able to do this (or even the ability to reinvent the passable ASCII?), ASCII seems just simple these days because many of the complex functions of its control codes are no longer used, using the old ASCII schools are often much more complicated than Unicode).

Numbers are used throughout computing, and we still have four different internal syntaxes (two entity styles, two padding styles), although data is usually hidden these days.

Like the execution of one part of the work of the creator of the format for them, and the demonstration of one piece of work for the manufacturer or consumer is the one with which they are already familiar (and, therefore, may already have tools for), it completely eliminates one piece of work for the manufacturer - a consumer who reads in one format and writes in another.

+3
source share

All Articles