Hot answers tagged

242

The real answer is XML has an L in the name because a guy named Raymond Lorie was among the designers of the first "markup language" at IBM in the 1970'ies. The developers had to find a name for the language so they chose GML because it was the initials of the three developers (Goldfarb, Mosher and Lorie). They then created the backronym Generalized Markup ...


180

Because it is a language. A markup language, not a programming language. Notice that natural human languages like English and Spanish don't "do" anything either. In fact, technically C++ and Java and the like don't "do" anything until they're fed into a compiler and the output gets executed. Doing stuff and being a language are largely orthogonal to each ...


103

Let Σ be a non-empty, finite set of symbols, called an alphabet. Then Σ* is the countable infinite set of finite words that can be formed by concatenating zero or more symbols from Σ. Any well-defined subset L ⊆ Σ* is a language. Let's apply this to XML. Its alphabet is the Unicode character set U, which is non-empty and ...


36

Because of the XML Schema Definition (XSD). With XML, you can have an additional file which describes the schema. It indicates, for example, that the element /a/b is an array and contains from 1 to 10 elements, or that the element /a/c is an integer. You can find an example of an XSD here. Validation of a given XML file through an XSD is supported by many ...


31

This page outlines quite a bit of the HTML/SGML history, and the rather convoluted rules of those two consecutive hyphens (double dash). The relevant part about SGML: To put it simply, the double dash at the start and end of the comment do not start and end the comment. Double dash indicates a change in what the comment is allowed to contain. The first --...


31

In computer science, formal language is just a set of strings, usually infinite and often described using rules (two common versions of those rules are regular expressions and formal grammars). Note that this means that all a language needs is syntax, language doesn't need to describe what each valid string means (that's called semantics). Now, this means ...


21

XML is lousy for data storage. First, it is very verbose. Data stored in an XML file will take much more disk space then the same data stored in any reasonable database system. In an XML record, the name of a particular field will be stored twice, along with the string representation of the data. So, for example, to store a single integar in a field ...


20

It's difficult to assess technologies when you don't have deep experience of them, but of course that's exactly when you have to make your decisions, so there's no simple answer to that dilemma. You cite two concerns: performance and usability. I'll try to address both below. Firstly, performance. Performance of course depends not only on the language but ...


20

XML can be type safe, since it it possible with XSD schemas to declare the data type of elements. A document validated against a XSD schema is guaranteed to conform to the expected types. But a XML format is not required to have a schema, so a document is not automatically type safe just by being XML. There actually exist a schema language for JSON also, so ...


15

The one that wraps all of the products into a single element. You can treat it as a collection in most programming languages that offer serialization/deserialization. See XML Serialization of Arrays and Collections Arrays and collections can be serialized to XML. The standard action when using the default serializer is for the name of the collection ...


14

To make sure that it works. Sure, if you only write out some data for your own application to read it may be enough if it just works. If you send a file to somebody else matters may be different. But even within your application you may later choose to switch the parsing library and the new one may complain about errors the old one accepted and ignored like ...


14

Because a double hyphen is the comment delimiter in SGML. The <! starts an SGML instruction, the -- indicates a comment. So basically it is for the same reason that a C++ comment cannot contain */.


13

Use a database, thats what they are for. File storage has its place, but I wouldnt use it for this kind of scenario. Consider, for example, getting a list of blog posts containing a certain tag. Doing that with a database is trivial - likely just a single SQL statement. Doing it with files will involve a lot of file manipulation.


13

We know the designers of XML were familiar with S-expressions, since XML is based on SGML, and SGML has a style sheet language, DSSSL, which uses S-expression syntax (and scheme as embedded scripting language). Nevertheless they chose a different syntax than S-expressions due to the use cases for XML. XML was initially designed to support both machine-...


12

This quote is not about using XML as a storage format in general (for which it is fine, depending on the requirements), but for database-type storage. When people talk about databases, they usually mean storage systems that store huge quantities of data, often in the gigabyte or terabyte range. A database is potentially much larger than the amount of ...


12

I think YAML is best fit for your case. To my understanding, YAML is the de facto standard format for configuration files that need to be edited by hand. Many programming languages have a library for reading and/or writing YAML. JSON is closely related to YAML, but is little bit less easier to write than YAML, and is used more for communication between web ...


12

Can we change XML format (i.e. create a new language which doesn't have the verbosity issue)? Yes, we can. In order to completely migrate to the "better XML" (let's call it BETXML), it would require to: Reimplement all the parsers, Rewrite all applications which currently use XML, Rewrite all protocols based on XML. Or we can keep everything in place, and ...


12

The proxy option is the easiest one to implement. You don't have any custom development to do, the only thing to do is to set up a proxy. It's also straightforward: there is no additional code to maintain, and if the API changes, you have no changes to make on your side. A proxy would be a preferred choice: If you need to ship working software fast. This ...


12

A language is a method of conveying information. A programming language is a method of conveying algorithms. A markup language like XML is a language for conveying data.


11

Because you can do many more things with real data besides display it in a web page. HTML is just a type of output that web browsers recognize, and it's not really useable as data in a meaningful way, because its metadata is about structure and form, not about the data itself. It also contains all sorts of things that have nothing to do with data output, ...


11

Its because its simpler - tools can be written to manipulate a XML document far easier than understand java code, so the layout can be created and modified by a simple tool that does not need to also be a java parser. Its also easier for people to describe a layout in XML than in java directly. This technique is used by a lot of things, eg WSDL that ...


11

Streaming API (such as SAX see https://docs.oracle.com/javase/tutorial/jaxp/sax/) vs DOM api's. Former one process tags as they occur, while the latter represents the entire DOM model in memory. See also https://stackoverflow.com/q/6828703/744133


10

Code Is Data. Or rather, programs are data. A source file is just a specific serialization of this program. This idea is e.g. common in homoiconic languages like Lisp. Such a language tears down the barriers between the program code, and the data it is operating on. This can be extremely powerful and expressive, although I would not call the appearance of ...


9

In general, I'd only add new documentation to the implementation's methods if there's something specific about that implementation that needs to be mentioned. In javadoc you can link to other methods, which would allow you to just create a link in the implementation to the method documentation in the interface. I think this is how it's supposed to be done ...


9

There is no clear documentation/best practice for this, but, consider the alternatives, as you have: As Element text: it can be easier to display the data as xhtml, etc, where the text content is considered text, rather than markup or meta-data. there can be more than one. If you need child content with multiple age or name rows, attributes won't allow ...


9

Does anyone know how the rainbow unicorns (Netflix, Amazon, Google, etc.) handle large files / data exchange between their services? Unfortunately I do not know how they deal with such problems. The problem is this - Does it make sense for all our microservices to be accepting this unique ID as part of their API for the purposes of interacting with ...


9

Most likely, you want a separate file. App.config is for application configuration, whereas what you are specifying is data. Your data store could eventually become a database or json, or whatever else. Keeping it separate will make moving to something else easier in the future.


9

XML and JSON are both capable of transmitting the same data, but which is better depends mostly on what you want to do with it. This does touch on existing tooling, but you're not likely to be hand rolling parsers for either, so it is relevant. XML Has better tooling for verifying schema. Has built in support for namespaces. Can be more easily ...


Only top voted, non community-wiki answers of a minimum length are eligible