Tim Bray on the Birth of XML, 10 Years Later 260
lazyguyuk writes "Tim Bray posts a lengthy blog on the birth of XML, formalized as 1.0 in Feb 1998. 'XML is ten years old today. It feels like yesterday, or a lifetime. I wrote this that year (1998). It's really long. The title was originally Good Luck and Internet Plumbing but the filename was "XML-People" and I decided I liked that better. I never got around to publishing it, so why not now?'"
Classic (Score:5, Funny)
Greybeard: Ok, but now you have 2 problems.
Re:Classic (Score:5, Insightful)
Best wishes on solving the semantic snarls.
XML, like all good approaches, handles mechanism, not policy.
Re:Classic (Score:4, Interesting)
To me that says that XML handles a problem that wasn't there. Parsing problem for pretty much everything is almost universally solved by regex...
I don't really care about the XML format. Personally, I'd be happier if it were stored in binary. The thing I like is the DOM tree as a data construct, XPath as a means of addressing, and XQuery as a means of getting parts out of it. (XSLT is okay, but from my experience, it's a lot clearer to represent a transformation as a series of productions than it is to use XSLT...perhaps a production-oriented approach that used XPath addressing?)
With those, you've got a good mechanism for serializing, reading, and deserializing objects, classes, and all manner of other things.
There are only a few problems with this:
1) Non-ancestor relationships and references (i.e., having the same node as multiple locations in the XML document) are not covered by XML, but are possible with objects.
2) Attributes in XML have no obvious mapping to objects...so what do you do with them?
I wish we could use something like XML (in that it could use DTDs as schemas, and had support for DOM methods along with XQuery and XPath), but with a more effecient format (binary), and with the ability to encode references.
That would be just about perfect.
Re:Classic (Score:5, Insightful)
Re:Classic (Score:4, Insightful)
XML doesn't handle parsing. XML makes parsing easier; in fact so easy that parsing XML isn't a problem anymore.
For an expert, I think XML and regex are complementary techniques. For anyone other than an expert regex are way too brittle. Ordinary people need to be able to operate on their data, it can't require voodoo. (Not that XML in all its arcane application is anything close to plain English, but it's much better than custom data formats and regex.)
Re: (Score:3, Informative)
Regex are not a solution to everything, and most certainly not to writing fast parsers!
(Not that XML is easy to parse fast, but that's another story. You still don't write a JSON parser using regex.)
Re: (Score:2)
This is a red herring.
No, not all natural languages are regular, and even most computer languages are not regular.
But I'm pretty sure that all languages (or to go more primitive, algebras) that can be expressed as XML can be parsed by a regular expression.
Can you disprove this?
That's easy to disprove... (Score:2)
<x><x><x><x>...</x></x></x></x>
See?
Re: (Score:2)
Sure (Score:2)
Re: (Score:2)
an instance of the following DTD or not:
<!ELEMENT a (a | b) >
<!ELEMENT b EMPTY >
This is quite basic language theory.
Re: (Score:2)
Re: (Score:3, Informative)
Re:Regex (Score:5, Informative)
This is why regular expressions are typically used for lexical analysis (tokenisation) not syntactic analysis (parsing).
Re: (Score:3, Insightful)
XML and Interfaces (Score:3, Insightful)
For other purposes, XML is great and very readable, but I'm not sure it makes sense to use it everywhere.
Re:XML and Interfaces (Score:5, Informative)
That's just what I can think of off the top of my head. We've seen quite a bit of crazy stuff. If everyone would just use one of the already written XML producers or parsers (the big ones, the ones that work) life would be much easier around here from time to time.
Here, let me fix that for you ... (Score:5, Insightful)
Re: (Score:2)
That will work until you need to use non-ascii content, to include the delimiter in the data itself (so that you need an escaping mechanism), you want to represent hierarchical data, you want to be able to compose data from different sources without semantic collisions, and what not.
So you solve these issues, turning for `simple delimited ascii text' format into something a bit more complicated, and next you will be wantint to interchange instances with others, so you will have to start coming to an agreem
Re: (Score:2)
"That will work until you need to use non-ascii content, to include the delimiter in the data itself (so that you need an escaping mechanism), you want to represent hierarchical data, you want to be able to compose data from different sources without semantic collisions, and what not."
Using a single null (0x00) to delimit each field, and two nulls to delimit each record, is UTF-friendly. As for non-ascii contents, just encode them in base64 (which you would probably be doing anyway in a cdata section).
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
"And what if you are not dealing with a table with record and fields but with a tree?"
Trees and graphs are not a problem - just like they aren't in regular table design (though it IS ugly). One field holds the parent node record id, or is blank if its a top-level node. A second field can hold the node type. Extend your schema as required.
Re: (Score:3, Informative)
Wrong - the special null delimiter is needed only for variable-length (and zero-length) fields and records. For fixed-length fields and records, no delimiter is needed.
For example: First Name\0x00Last Name\0x00Age0x00\0x00
Joe\0x00Blow\0x0042\0x00\0x00
Mary\0x00Doe\0x0024\0x00\0x00
\0x00Cowboyneal\0x00\0x00\0x
Re:Here, let me fix that for you ... (Score:4, Insightful)
Re: (Score:2)
"ASCII doesn't even support the letters needed by the majority of the world's language."
UTF does - so just use UTF - no big deal, and a lot easier to parse out than xml, which is butt-ugly to parse, terrible to index, doesn't support random access read/write, etc.
Re:Here, let me fix that for you ... (Score:5, Insightful)
It amazes me how something that looks so simple can have so many corner cases, and how they can be solved so differently by different implementations.
CSV is fine if you want to store data that has no quote marks, commas, carriage returns or linefeeds. For everything else, please use a better specified format, preferably one that has a formal definition. Like XML, for example.
Re: (Score:2)
Plain ascii text != csv.
You can delimit your data with nulls, for example (1 null byte per field, 2 null bytes per record). Even javascript can parse that out, and its unicode-compatible.
Or you can use fixed-width fields and records, in which case reading a record is as simple as an lseek (header_size + record_len * (recno - 1)). Generating indexes on the data is also much quicker, as is editing the data. With a fixed-width field and record, there's no need to rewrite the rest of the file if your new v
Re: (Score:3, Informative)
"Ever tried parsing CSV?"
All the time. Its not that hard. Also, if you're worried about such things as quoting, etc., you can always use fixed-width fields - makes indexing, looking up, and modifying values REAL FAST. Compare that to the mess of xml.
Re:Here, let me fix that for you ... (Score:4, Interesting)
Re: (Score:2)
Re: (Score:2)
You'd think. Proper XML isn't a problem. What we run into is people who's XML parsers (which we usually suspect to be customer, often in the form of simple string extraction and not even real parsing) who have these weird little desires that are contrary to the XML spec. Some of it seems sane, some of it is way off (I've seen XML, that gets URL encoded, put in a CDATA block, in XML... and that was how they sent everything).
XML, done right is just fine. But some people just get it very very WRONG.
Re: (Score:2)
Re: (Score:2)
Unfortunately, as you point out, very few do. I'm sick of not-quite-standard crap as well. It's a nightmare to work with... Even moreso than no standard would have been.
XML was formalized? (Score:2)
Add to that the fact that then the ability to "display" XML comes down to the whatever-you-want-to-write manner, and I think there are plenty of people who would be hard to convince that there really is a "formal standard" for XML.
Perhaps Duke Nukem Forever will be written with this fantastic standard?
Re:XML was formalized? (Score:5, Insightful)
If you encounter a file that claims to be XML, but does not meet the XML standard, then it is not the XML standard that is to blame. The claim is wrong and the file is not XML.
XML is not a fuzzy-wuzzy adjective that can be applied willy-nilly to anything and magically turn it into "XML". It is not a marketing term or English Professor term. It is a rigidly specified engineer term for a document format, and a given document is XML if and only if it meets that format.
If someone wants to hack together a half-assed parser or emitter of any language, they will. I've seen half-assed XML parsers, I've seen half-assed JSON parsers, I've seen half-assed HTML parsers, I've seen half-assed YAML parsers, I've seen
Re: (Score:2)
Forgive my lack of knowledge on XML - I primarily just see bad implementations of it.
But what problem was XML supposed to solve? Exactly who/what/where was in need of an extensible markup language, anyways?
Re: (Score:2)
Java and XML, bad tastes that are worse together (Score:4, Insightful)
I've recently taken a job at a primarily Java shop. After seeing XML used and abused for ant, maven and various other things I've grown even more disenchanted with it. And now I've also gotten the chance to see that not only does Java represent a poor trade off between the annoyances of a strongly typed language and the speed of a dynamic interpreted one, it has a horrible mess of dependency issues that nobody really solves besides.
I'm much more hopeful about technologies like Thrift [facebook.com] and/or D-Bus [freedesktop.org] than I ever was about such abysmal abominations as SOAP, or the only slightly better XML-RPC.
The Java XML world seems like this little closed ecology of mutual masturbators who all come up with more Java and XML 'solutions' to problems that never existed before they started using Java and XML.
I see the value of XML for long-lived documents that don't spend a lot of their life on the wire. And possibly for config files, though IMHO it is too ugly and unreadable for those. But as a general tool for Internet plumbing it's awful.
Java and XML - Addendum (Score:4, Insightful)
And, of course, my post is incomplete with reference to my little rant on why CORBA and other forms of RPC are bad [omnifarious.org]. Both Thrift and D-BUS are pretty close to the ideal solution I describe later. They focus on message content over semantics and are extremely easy to parse. SOAP and XML-RPC fail on both of those counts. They are about semantics (you are making a remote function call that does some specific thing, not sending a hunk of data that has some particular content) over content and they are a huge pain to parse.
Re: (Score:3, Interesting)
Re:Java and XML - Addendum (Score:5, Insightful)
CORBA is a minor pain to parse. From what I could tell you could just sit down with a spec and code up your own parser for ye-old random language in a day or two. But that's not my major issue with it.
My major issue with it was that it promotes designing distributed systems that focus on the semantic roles of the participants instead of the data moving around. In fact it discourages programmers using it from even thinking of what they're doing as sending messages to some system many milliseconds away. Among other evils this leads to all kinds of interesting issues with threading and concurrency that didn't even have to exist.
Re:Java and XML, bad tastes that are worse togethe (Score:3, Interesting)
I do a lot of Java and XML. I don't know what you're using for a library, but I'd suggest JDOM.
As for the abuses for Maven and Ant... yeah. I'll agree. There are a lot of things that seem to use XML just because they can. I know there is some theory behind why they use them (machine readable, blah blah blah) but for most things it's just a giant pain for the complexity you get. Maybe if you were trying to build Windows with Ant.
Re:Java and XML, bad tastes that are worse togethe (Score:5, Insightful)
Re:Java and XML, bad tastes that are worse togethe (Score:4, Informative)
Re: (Score:2, Informative)
Re:Java and XML, bad tastes that are worse togethe (Score:5, Interesting)
Yay! Nothing like the combination of XML and Java to bring out the haters. Incompetent use of a language/API doesn't equate to a bad language/API. I can show you plenty of crappy C/C++ code freely browsable in some open source libraries. Does that mean C++ sucks? Hell no.
My experience with Java+XML you ask? OFX servers for financial institutions. Without name dropping, check out the list of banks, brokerages, tax services, and credit card providers [microsoft.com] (Quicken [microsoft.com]) out there successfully serving up client data. I guess we're all circle jerking while you're downloading your account information into Quicken or Money.
Some good uses for XML:
Some bad uses for XML:
I have to admit, I'm clueless about your Java dependency issues. The only way I can see that ever happening is if you're dumping all of your classes into the default top-level package; and that's major user error if you are.
Re: (Score:2)
No, but incompetent design of a language/API does, in fact, equate to a bad language/API.
Re: (Score:2)
OFX servers for financial institutions. Without name dropping, check out the list of banks, brokerages, tax services, and credit card providers (Quicken) out there successfully serving up client data.
I'm aware of OFX, and it is something I consider a non-evil use of XML. It is all about the data, and the data is high-volume, structured and text-like, so something like XML makes sense for representing it.
OTOH, name dropping gets nowhere with me. Large institutions routinely adopt very stupid technologies for the most ridiculous of reasons. I'm much more interesting in what a small, nimble high-tech company like Automated Trading Desk [atdesk.com] is doing than what Chase-Manhattan is doing. Of course, ATD appe
Re: (Score:2)
That's Maven's job. It's supposed to get all the JARs you tell it to.
It's not Maven's job to figure out if you actually use a JAR (which gets complicated when code depends on JAR A, which depends on JAR B, which....).
The usual way to handle something like this is to use Maven to keep things up to date on your machine. You can deploy all those JARs with your program (as you seem to be doing) or you can keep them somewhere else on the server and update them manually. Maven makes sure you have the requisite
Re: (Score:2)
You tell me what is a standard in Ant? Nice taking his comments out of context.
Re: (Score:2)
The success of XMPP, which is entirely centered around the concept of an XML stream, seems to disprove this.
Normally true, but for small catalogs of a few hundred records at most, one may consider XML for its ease of handling and recoverability.
Also, for tree-like structures, XML/XQuery databases can often beat relational (once you start getting into 10+ joins in the latter, that is). Of course good XML databases don't really st
Re: (Score:2)
Your comments seem tainted with inexperience. (Score:3, Insightful)
In general, if you have data to be structured and serialized, XML is one way to do it. If you think XML a poor choice, then could you suggest an alternative? Incidentally, that suggestion should not imply that everyone reinvent their own formats (again).
Would you provide evidence aside from personal anecdotes, and possibly consider evidence to the contrary [wikipedia.org]?
Re: (Score:2)
YAML for the win!
YAML is concise, easy to read, easy to write, easy to parse, easy to edit.
It has high signal-to-noise ration, and is effortless for the human eye.
It can represent any data structure I can imagine.
It has libraries for any popular language I can think of.
Re: (Score:3, Informative)
Depends on the problem you're trying to solve.
A hell of a lot of the stuff I'm seeing in XML these days would be better off as token-separated self-describing tables (tables where the column names are the first row), or a modestly extended token-separated format like CSV.
For binary data something derived from Electronic Arts semi-self-describing interchange file format is good, examples in current use are MIDI File Format and Portable Net
Re:Java and XML, bad tastes that are worse togethe (Score:2)
Re:Java and XML, bad tastes that are worse togethe (Score:2)
I can see your viewpoint, if you want to squeeze as much performance out of your application you might want to investigate Thrift, D-Bus or simply write your own TCP protocol.
Oblig (Score:5, Funny)
Re: (Score:2)
Re: (Score:2)
As to semantics, if you're trying to interpret such a home-grown format as atom/rss, without reference implementation (and most specifically without a good test), your problems lie not with XML, but with that spec.
And indeed, RSS and atom aren't very good in that sense. It may be hard to
Is XML just SGML redux? (Score:2)
As a side note, I dislike it when people use XML inappropriately, like using XML-RPC when something based on ASN.1 might be more appropriate. (How many wannabe MMORPG projects have I read that are "XML-RPC" based? too many). I'm sure there are good uses fo
XML lite (Score:2)
For config files and such.
- No doctype needed
- tags are case insensitive
- Can do comments with # character instead of
- Etc
Inferior to S-expressions (Score:2)
TFA is a fun read. Too bad XML sucks. As Jerome and Philip Wadler write [ed.ac.uk], "[T]he essence of XML is this: the problem it solves is not hard, and it does not solve the problem well."
Lisp had the same problem solved 40 years earlier. While a lot of people find S-expressions verbose, XML is quite a bit more verbose. Slava Akhmechet has a nice essay [defmacro.org] on the relationship between the two notations.
Re: (Score:2)
Whoops -- the authors of the linked paper should have been given as Jérôme Siméon and Philip Wadler. Sorry for the error.
Re: (Score:2)
If it was easier to handle dates in JSON without schemas, we'd have one heck of a winner there though.
What's happened with XML reminds me of... (Score:2)
XML isn't the problem. Idiots writing XML is. I'm beginning to think that a certain level of difficult is necessary as a screening device.
Comment removed (Score:5, Informative)
Re: (Score:2)
Just like LaTeX! Reinvention is a wonderful thing.
Comment removed (Score:4, Informative)
Re:10 Years and still waiting (Score:5, Informative)
Re: (Score:2, Interesting)
The hatred for XML, I think, stems from frequent, ugly misuse. Here's one basic, freakin' obvious rule: if a human, at any time at all, has to read or manually edit an XML document, you're doing it wrong. Just because it's ASCII doesn't mean it's human-compatible.
Re:10 Years and still waiting (Score:4, Insightful)
Re: (Score:2)
Here is another obvious rules: If a computer, at any time at all, has to parse or generate XML in large amounts, you are doing it wrong
Depends on what you're doing.
One computer storing temporary data? XML is worthless. A computer storing data for use on said same computer? XML brings little to the table.
One computer program writing something that a different computer program will read from a file system at a later date? Look at XML. If you save a non-trivial amount of processor or developer time, go with it.
And let's ignore the fact that AJAX really doesn't work without XML, will we? Because that kind of defeats the original whiney
Re: (Score:3, Insightful)
Re: (Score:2)
Amen! Which is why I absolutely HATE HATE HATE XML config files. Because they aren't human readable and editing one is an invitation to disaster. There are no editors so XML is only useful for apps to communicate with each other. And there are equally useful ways for that to be implemented.
Seriously, there is no editor. I'm told you can buy them for Windows i
Re: (Score:3, Insightful)
when you are entering html style markup tags, you are using xml. but xml is a much much larger subject than that. hand editing a website is fine. (if the documents are getting huge, it should be split into smaller files and automated somehow, anyway) hand editing, say, Open Office's xml format or any of the fairly arcane XMl formats used for interprocess communication.
XML is sort of designed to be the second best data format for any application. There are a lot of
YAML and JSON (Score:3, Insightful)
Re: (Score:2, Insightful)
Using an XML file basically consists of the following code:
NSError xmlError = [[NSError alloc] init];
NSXMLDocument doc = [[NSXMLDocument alloc] initWithContentsofURL:@"Put your URL here" options:NSXMLDocumentTidyXML error:&xmlError];
Then you can basically do anything with your doc object. You can insert a child at a certain index, you can
Re: (Score:3, Informative)
Re: (Score:2)
Is that really worth it, only to make editing files with a simple text editor easier?
I think you answered the question. Yes. for many uses being able to use a simple text editor is great.
Have a look sometime at the yaml documetnation quick reference-card : it's written in YAML and fits on one page. That's how compact yet human readable it is, try that in XML. [yaml.org]
These days everything is one library away from being immediately available for use. Since YAML can do everything XML can do, and because it's trivial to insert XML into YAML (but not the reverse), you really could replace XML with
Re: (Score:2)
Re: (Score:3, Interesting)
Actually, after looking at that reference card, YAML is much more complex than I thought it was.. compared to that, XML is simple (provided you ignore all that outdated crap like DTD/Doctype, processing instructions) and just use elements, attributes and built-in entities.
Well good for you, for actually looking. But as you say about XML, most of the time you only use the base elements in YAML too. In YAML those are "-" for arrays, ":" for hashes, and "|" for block quotes. YAML streamlines things even further by getting rid of close-tags and it mostly dispenses with attributes being special data and having to live in tag, and just merges them all into the payload area, putting all data and attributes on equal footing.
Here's another document to look at that's a great 1-pag [yaml.org]
Re: (Score:3, Insightful)
That's pretty much completely wrong. YAML's functionality is a superset of XMLs while being easier to read & understand (because the *basic* usage of it is exactly the same as XML's, but with a simpler syntax). It just hasn't been adopted anywhere except configuration because that's the easiest niche to move into.
it's just another syntax to learn.
That's a stupid thing to say. Anybody that can't learn the syntax of either XML or YAML in less than five minutes sho
Re:YAML and JSON (Score:5, Funny)
<paragraph>
<sentence>What?</sentence>
<sentence>Are you telling me that this isn't the preferred way of presenting data?</sentence>
<sentence>Honestly, this & SOAP are two technologies that have made my life so much more "interesting" as a developer.</sentence>
<sentence>Fucking XML...</sentence>
</paragraph>
</reply>
Re: (Score:2)
Re: (Score:3, Insightful)
I've never understood why people complain about XML as you do.
Are you generating XML by hand in your applications? Are you not parsing it using some standard library into an abstract tree or using a standard library to transform XML documents into sequences of events, in exactly the same way lex tokenizes a string of characters? Are you generating it by concatenating strings?
SOAP is complicated, but that has nothing to do with XML.
XML does exactly one thing: it allows you to pretend that data is provide
Re: (Score:3, Interesting)
Re: (Score:2)
For example, macintosh plists, many of which replace older ad hoc Unix configs, are in XML.
Property lists are part of the OpenStep specification (circa 1993). They have one canonical representation, which is similar to JSON (which postdates it by some years). OS X also supports two other representations, one is XML, the other binary. The XML form is commonly used on OS X, presumably so that they can be modified using XSLT or XPath type things.
I agree, it doesn't make a huge amount of sense. Both the old format and the binary format are easier to parse than the XML format, and the old form
Devolution (Score:2)
Re: (Score:2)
Why oh why do people use XML for data centric, quasi-human readable configuration files when YAML is the ideal solution for this.
I'm looking at the YAML 1.1 specs [yaml.org] and don't see anything about schemas or data validation. Am I overlooking something?
because you don't have to instantiate the multi-megabyte structured data entire file just to grep out one record.
You don't have to do that [wikipedia.org] with XML, either. You can, but you don't have to.
But really folks, do yourself and the rest of us a favor and read up on JSON and YAML.
(Un)?fortunately, "the rest of us" seems to make up about 5% of the programming population. The rest of the rest of us are using XML.
Re: (Score:2)
If everyone had jumped on the boat 10 years ago, it might have. But that didn't happen.
XML is too difficult, and allows abuse/over-use too easy. Personally, I love it, but I'm a minority. The other key-factor is that there is simply no short term need for it in many places. Or better, the need for it isn't recognized by the majority. Pragmatic solutions have a tendency to win over new revolutionary ones.
Re:10 Years and still waiting (Score:4, Informative)
You want to transform the document, you can use any of a number of techniques, and trivially guarantee that the resulting document is at least syntactically valid. If you use a home-grown format (or HTML), you'll need to resort to regular expressions, or a custom parser - which works fine up to a point. Regex's are error prone (it's quite difficult, for instance, to make an untrusted HTML document safe with regex'es), and parsing is difficult, and doesn't solve the transformation step very elegantly - wheras XPath and others are absolutely brilliant for quickly distilling the stuff you need from a document.
But on the parsing side... take a look at ANTLR, it's just great
Re: (Score:2)
Re:IVE BEEN WAITING SINCE 1998 (Score:4, Funny)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
XOP optimizes only the transport of base64 encoded binary objects. When you parse the file with a XOP-capable parser, the element would look to you like a base64 string.