Once HTML is defined as an XML DTD, there is immediately a need to mix the tag sets of HTML and the various XML applications such as MathML, SMIL, schematic graphics etc. Such mixing is also needed in RDF where the tags may come from RDF itself or the specific RDF application.
Namespaces in XML is designed to address this problem. It was released as a W3C Recommendation on 14 January 1999.
The somewhat contrived example below is based on the example used in the March 1998 Newsletter article on XML where an XML set of user-defined tags for marking up an exam paper was described:
<?XML version="1.0"?> <exam course="Brunel_207.3"> <student>John Smith</student> <question>Who is the last King of England</question> <answer>George VI</answer> - - - </exam>
Here we have introduced the tags exam, student, question and answer and exam has an attribute course. It may well be that at Brunel University there is already a record of students defined in XML as:
<?XML version="1.0"?> <studentset> <student_record> <student>John Smith</student> <age>19</age> <sex>male</sex> <nationality>UK</nationality> </student_record> - - - </studentset>
and also a record of courses:
<?XML version="1.0"?> <year_two> <comp_sci course="Brunel_207.3"> <prereq course="Brunel_105.3"/> <exam_date>15.01.98</exam_date> </comp_sci> - - - </year_two>
The tag student appears in two of these XML tagsets as does the attribute course. The exam paper could use the tags defined for the record of students and the record of courses. If unique, processors can decide which action to take on which tags. So how is that done?
That is the question tackled by the XML Namespace Recommendation. The answer is to add a prefix that identifies which tagset each name comes from and provide a unique identifier for the prefix.
To make the record of courses unique using XML Namespaces, the example would change to:
<?XML version="1.0"?> <csr:year_two xmlns:csr="http://brnl.ac.uk/csrcns"> <csr:comp_sci csr:course="Brunel_207.3"> <csr:prereq csr:course="Brunel_105.3"/> <csr:exam_date>15.01.98</csr:exam_date> </csr:comp_sci> - - - </csr:year_two>
All the tags are now prefixed by csr and are uniquely identified by the URL in the xmlns namespace declaration. Often, the URL will point to the Document Type Definition (DTD) for the tag set but that is not required. Its main purpose is to establish the uniqeness of the nameset by quoting a URL which is, by definition, unique. The same can be done for the student records:
<?XML version="1.0"?> <sr:studentset xmlns:sr="http://brnl.ac.uk/strcs"> <sr:student_record> <sr:student>John Smith</sr:student> <sr:age>19</sr:age> <sr:sex>male</sr:sex> <sr:nationality>UK</sr:nationality> </sr:student_record> - - - </sr:studentset>
There are various defaults that are allowed so that the prefix can be omitted when it is clear which tag set the element belongs to. Going back to the original example of the exam paper, this would now be written:
<?XML version="1.0"?> <pap:exam xmlns:sr="http://brnl.ac.uk/strcs" xmlns:csr="http://brnl.ac.uk/csrcns" xmlns:pap="http://brnl.ac.uk/marking" csr:course="Brunel_207.3"> <sr:student>John Smith</sr:student> <pap:question>Who is the last King of England</pap:question> <pap:answer>George VI</pap:answer> - - - </pap:exam>
For further details, see: http://www.w3.org/TR/REC-xml-names/.
Having just broken through the 300 barrier, membership has quickly risen to 316 with a rush of new members since December. The opening of Offices in Taiwan and Hong Kong has been instrumental in increasing the participation from that part of the world. The current breakdown is:
Full | Affiliate | |
---|---|---|
Americas | 45 | 144 |
Europe | 28 | 60 |
Asia-Oceania | 17 | 22 |
The new Members since December are:
The funding for the UK Newsletter comes from the Esprit W3C-LA Project to raise awareness of W3C's activities in Europe. This project was due to complete at the end of January but it has been extended to complete by the end of March.
At that time, the plan is to revert to a web-based version. In anticipation of this, the first year of Newsletters is being made available on the Web.
As reported last month, the BCS Electronic & Multimedia Publishing Specialist Group is hosting a one-day meeting on metadata on 10 March 1998 in London.