I began writing this book in HTML, then switched midstream to XML. Using terms from Chapter 5, I converted a docbase whose repository format and delivery format were both the same stream of HTML into a docbase whose repository format is XML and whose delivery format is HTML. Here are the lessons I learned when I did that.
XML doesn’t have to involve complex document type definitions (DTDs) written in weird syntax that’s hard to understand and use. Of course, there are good reasons to use DTDs, but the inventors of XML wisely chose to make them optional. As a result, the initial conversion of my HTML manuscript to XML was a trivial exercise that took just a few hours. There were just three rules I had to apply:
Close all tags.
Quote all attributes.
I used keystroke macros in my text editor to add
end tags to
<img> elements. To close an empty tag such
<img>—that is, a tag that has no
content other than its attributes—you need only precede the
trailing angle bracket with a forward slash, like this:
I also used search-and-replace to escape the ampersand (&), which
in XML is written as
&. This applies to
invidual ampersands as well as those that introduce HTML entities
This XML-ized flavor of HTML now has its own acronym: XHTML (Extensible HyperText Markup Language, http://www.w3.org/TR/xhtml1/ ...