White space

Volume 9, Issue 23; 23 Feb 2006; last modified 08 Oct 2010

On white space and mixed content. A rant.

This is a rant. A tirade. A lunch-time release of pent up frustration. Move along, nothing to see here.

Hey, you! Yeah, you! XML editing tool vendor! Lemme ask you something, why is it that you think you can fuck with the white space in my mixed content? White space in mixed content is significant. If I put it there, leave it alone! If I didn't put it there, keep your “helpful” fingers out of it!

If I typed this:

<para><emphasis>This</emphasis> is what I typed. It's what I meant.
If I meant something else, I would have typed something else. If you so
completely hide the details from me that I can't <emphasis>tell</emphasis>
what I typed, that's a bug. Leave my white space alone!</para>

You aren't allowed to turn it into thisWell, technically, we could argue or maybe agree to disagree about the white space before the opening para tag because that isn't mixed content. At least it isn't mixed content if you've validated the document and determined that it isn't, you know, mixed content. If you haven't validated, you're not allowed to muck with the white space there, either. Get over it.:

    <para><emphasis>This</emphasis> is what I typed. It's what I
    meant. If I meant something else, I would have typed something
    else. If you so completely hide the details from me that I can't
    <emphasis>tell</emphasis> what I typed, that's a bug. Leave my
    white space alone!</para>

I'm talking to you, XMLmind.

And for pity's sake, you sure as hell aren't allowed to turn it into this:

    <para>
        <emphasis>This</emphasis> is what I typed. It's what I
        meant. If I meant something else, I would have typed something
        else. If you so completely hide the details from me that I can't
        <emphasis>tell</emphasis> what I typed, that's a bug. Leave my
        white space alone!</para>

That's you, XMLSpy.

Emacs of course, leaves it alone. Arbortext's editor leaves it alone. Oxygen appears to do the right thing. Even xed gets it rightNo, I have no intention of trying all the other myriad editors out there. This is a rant, not a carefully crafted, impartial review. All tools suck.

And don't tell me you have some configuration switch that makes the results come out right. Unless that switch is the default, your editor is broken.

It's not rocket science folks. My white space is…mine!

Comments

A bunch of us have been talking about linebreaking algorithms for XHTML, and compatibility across Amaya, tidy, and nvu, so that CVS diffs don't go crazy. I think some folks are getting together at the tech plenary to talk about it.

I suppose it's not exactly the same issue, but it's nearby.

—Posted by Dan Connolly on 24 Feb 2006 @ 12:26 UTC #

Wuddaya mean, "even xed"? Xed is the coolest XML editor on the planet. (Well, except for insisting the document hasta be well-formed before you can edit it.)

—Posted by John Cowan on 24 Feb 2006 @ 03:35 UTC #

Apologies, John (and Henry!). I certainly did not mean to cast aspersions on xed's character.

—Posted by Norman Walsh on 24 Feb 2006 @ 12:13 UTC #

Enjoyed the rant. I have tread where your footnote 4 says only fools go. I am preparing a roundup of the top dozen XML Editors for EContent Magazine.

I'd be glad to send you a draft copy if you would like to criticize it - your rants most welcome.

We will almost meet in radio space tomorrow at the DITA 2006 Live! Show.

I am on from 3:00, you from 3:30. Maybe they will let us say hello to one another?

Bob.

—Posted by Bob Doyle on 24 Mar 2006 @ 02:19 UTC #

Nice rant, and actually I stopped using XMLSpy a long time ago, the day I found out it messes with whitespace. But, what's wrong with the first example (XMLMind result)? Do you assume that para has xml:space="preserve"? Or do you consider that XML should never be canonicalised?

—Posted by Benoit on 19 Jan 2007 @ 01:56 UTC #