A developer came to me today and asked me to check his xml against the schema he was writing it to. It was exactly one week since I had offered to check it originally. He had struggled with it in the intervening seven days, trying to work out where his code didn’t match.
It took two minutes to find the three places where the xml didn’t match the schema. He could have found that out seven days ago.
It is common among both developers and technical writers who work with xml to look on schemas (the XSD files) as a necessary evil. Something they grudgingly have to accept because it’s been directed from high, but not something they would use if they didn’t have to. They do their coding, or their writing, first, and then try to force it to fit the schema.
If you are one of these people, you’re doing it all wrong.
Start at the other end. Start with the schema. Write always with the schema in mind. Don’t even think of starting your work until you understand what’s in the schema and how it fits together.
XML-Spy does diagrams of schemas. I offered that same developer a diagram. “No,” he said. “It’s not necessary. I’ll work through it.”
This was a fairly complex schema he was working with. One of those third-party data feeds that we take information from, transform it, and put it into our system.
“Fine,” I said, but I have to admit I thought he was making the job unnecessarily hard.
You might think it strange that I am picking on developers in a technical writing blog, but let me tell you, a lot of tech writers have the same attitude. The same people who happily accept that a style manual is necessary, and that a document template is compulsory, consider the schema a nuisance—something that makes their job harder, restricts their freedom and adds extra work.
It’s not. It makes your job easier. Now, when you are writing the initial documentation, and definitely later, when other people are updating it.
But … you have to start with the schema, not with the document.
Let’s take a practical example.
Below is a diagram of a very simple schema. Dotted lines mean an element is optional, straight lines mean it is compulsory. You don’t get schema diagrams everywhere, by the way. The xsd file is just text—a special xml file, but if you can get a picture of the schema it’s going to help you enormously. If you want to see the original schema, it’s here.

DITA users will notice I tipped my hat in their direction with the tasks thing, but comparing this schema to DITA is like saying the scooter a child rides to school is like an 18-wheeler truck. They’re both transport.
What can you tell me about this schema?
It’s pretty basic, isn’t it.
There is an outer node called task, with three attributes (all compulsory), an optional introduction, some steps, and then an optional conclusion. The introduction and conclusion are one element each, so you know immediately that there’s no point writing reams and reams of introduction.
The most important thing to see from the schema is that there is room for only one paragragraph in the introduction and conclusion. If you know this before you start then you won’t bother writing a whole page of introduction which you later have to cut down.
Likewise the steps. Each step is a single paragraph and there is no bold or italic or any other emphasis. (I know, it’s unrealistic, but it’s only an example.) From this you know you can’t have big, long-winded steps. There’s no room for graphics either. Write simple steps. Anything else and you’re going to have to rewrite. So don’t write it to start with. The end result looks something like this.
If you follow the schema guidelines, it’s not hard to set up each task. If you write the task first, and then try to fit it to the schema, you’re bound to have problems. Just like my developer friend, who persisted, despite everything, in writing the code first and then trying to make the code fit the schema. If he’d written the code to match the schema it would have saved him seven days, probably more.
The schema is your friend. Stop thinking of it as a necessary evil and start thinking of it as the time-saving device it is.