All posts by Lachlan Hunt

XML Prologue

One thing I come across frequently is incorrect terminology. I’ve written about this topic once before (see HTML Tags) and others have discussed similar topics as well, particularly relating to elements, attributes and tags. But a more specific area that deserves a little more attention is the distinction between the DOCTYPE, the XML declaration and the XML prolog and other things within it.

The XML Prolog is the section at the beginning of an XML document which includes everything that appears before the document’s root element. The XML declaration, the DOCTYPE and any processing instructions or comments may all be a part of it. The following figure illustrates this concept.

The diagram highlights the XML Prolog at the beginning of a sample XHTML 1.0 document containing the XML declaration, a processing instruction, a comment and the DOCTYPE.

In fact, the XML Prolog is always present in every XML document, though it may in fact be empty because all of those are optional in some circumstances.

The XML Declaration

<?xml version="1.0" encoding="UTF-8"?>

The XML declaration, if present, must occur at the very beginning of the file. It may not be preceded by anything except for a possible Byte Order Mark (depending on the character encoding). It is mostly used to provide XML version information and to declare the character encoding of the document. There is another thing called the standalone document declaration; but since it’s rarely needed or used and its purpose is not easy to explain, just ignore it.

Presently, only XML 1.0 and XML 1.1 are defined. Either may be used, but the decision should not be made lightly. Do not just use version="1.1" because it is higher version number. For most authors these days, version="1.0" should be used. In fact, unless you have a specific reason that requires the use of XML 1.1 features, you should stick with 1.0.

The encoding declaration, if present, must declare the encoding of the document. Authors may use any encoding supported by user agents, but are encouraged to use charsets registered with IANA (preferably UTF-8 or UTF-16). If the declaration is not present, the document must be encoded as UTF-8 or UTF-16 (unless it specified by a higher level protocol, like HTTP).

Processing Instructions

<?xml-stylesheet type="text/css" href="/style/design"?>

Processing Instructions are used to provide instructions to applications processing the document. The example of the xml-stylesheet PI given in the above diagram is used to instruct an application to apply a stylesheet to the document.

PIs can be used almost anywhere within the document. Though, only those that appear prior to the root element are considered part of the prolog.

Comments

<!-- This is a comment -->

Most people know what comments are, there’s not much I need to say about them. However, like PIs, they’re only considered part of the prolog if they appear before the root element.

The Document Type Declaration

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Many authors will have seen and used a DOCTYPE in their documents, although there are still many who don’t. The DOCTYPE is used to reference a Document Type Definition and is mostly used for validation purposes.

Many people know that using specific DOCTYPEs will trigger standards mode in browsers, but this does not apply to XML documents. DOCTYPE sniffing only applies to HTML documents (i.e. any document served as text/html). Browsers have, thankfully, not introduced it into XML processing. Henri Sivonen explains more about this in Activating the Right Layout Mode Using the Doctype Declaration.

Open Letters to Save Stargate SG-1

Following the airing of the 200th episode of the series Stargate SG-1, the announcement was released stating that the show will be cancelled at the end of season 10. I, for one, am absolutely distraught by this shocking news, as will many of my friends who are also fans of the show. However, the spin-off series Stargate Atlantis is safe for another year, having been contracted for a fourth season.

The campaign Save Stargate SG-1 is asking fans from all around the world to show their support for the long running series in the hope that the Sci Fi channel in the US will change their mind or that the show may be picked up and produced by another network. One of the ways to show support is write a letter to MGM, the Sci Fi network and/or your own country’s TV network that broadcasts the show. I have written one letter to be sent to MGM and Sci Fi, and another to the 7 Network in Australia.

The following open letter is the one I will be sending off to MGM/Sci Fi.

After hearing the devastating news of Stargate SG-1’s cancellation, I wanted to express my disappointment in regards to this decision. I love Stargate, both SG-1 and Atlantis, and, in my opinion, it is greatest television series of all time. To lose Stargate SG-1—the show which captured my imagination, and that of many of my friends, at a very early age—would truly be a very sad end to an era.

I have watched every episode to date, without fail, and eagerly await the new episodes each week. Over the years, I have also purchased every episode released on DVD (currently up to season 9) and will continue to do so. In fact, if the episodes were available for download in Australia from iTunes, I would quite happily purchase them instead of waiting several months for the episodes to be aired on the 7 Network.

Your decision to discontinue this phenomenal series will greatly affect millions of fans all around the world and I dearly hope that season 10 will not be the last we will see of SG-1! Thank you for bringing such a wonderful series to us for the past 10 years.

The following is a modified version that will be sent to Australia’s 7 Network.

After hearing the devastating news of Stargate SG-1’s cancellation, I wanted to express my disappointment in regards to this decision. I love Stargate, both SG-1 and Atlantis, and, in my opinion, it is greatest television series of all time.

To lose Stargate SG-1—the show which captured my imagination, and that of many of my friends, at a very early age—would truly be a very sad end to an era. I have watched every episode to date, without fail, and eagerly await the new episodes each week. I only wish they were aired at a more reasonable time, instead of Thursday’s at 23:00.

It has been reported that Sci Fi’s contract with MGM legally prohibits them from producing new episodes so I writing to you to respectfully request the 7 Network to approach Charles Cohen, Executive VP at MGM, to work on an international co-production deal that would bring in partner networks from other countries, in order to keep the show alive.

Thank you for supporting Stargate for the past 9 years and I dearly hope you will continue to do so for many more years to come.

If you’re a diehard Stargate fan, like myself, please get involved in the campaign and do your part to save the show. Feel free to use my letters as a basis for your own or one of the templates made available by the campaign, though you should try to personalise it a little for yourself.

However, it has been stated that even though the series is ending, it probably won’t be the end of the SG-1 franchise. This has given rise to speculation about what may follow in the future. Could we finally see the rumoured feature film: Stargate II; perhaps a mini-series or even a thrid spin-off series, following in the steps of Stargate Atlantis and the cartoon series Stargate Infinity? Only time will tell.

Web Forms 2.0 W3C Working Draft

The Web Forms 2.0 specification that was drafted by the WHATWG has been published as a W3C Working Draft. This spec provides many enhancements to traditional HTML forms including new form controls, a repetition model, XML submission, and DOM interface and event enhancements.

The spec is still being developed by the WHATWG, but has been published by the The Web Application Formats Working Group’s Rich Web Clients activity.