Let me suggest the following premises:
A: Since Namespaces will be fitted to a future version of XML (and by
implication all XML-related drafts - XLL, XSL, etc.) all syntactic
processing should occur in the parser or SAX interface where possible. In
other words we want to remove as much burden from the application.
B: Much of the current namespace spec is about minimisation. The prefix
acts as a minimisation device. Scoping acts as a minimisation device. The
SAX interface can expand minimised parts of a document to full
UniversalNames (however held). The actual syntax of minimisation should be
irrelevant to the application, i.e.:
which prefix was used
whether a namespace was default or not
whether a prefix was implicit through scope
(The only reason for the application receiving the prefix would be that it
wished to be able to transform the document using the same prefix).
This is similar to the question as to whether <FOO></FOO> and <FOO/> carry
different semantics. The WG has decided they do not. I would hope that the
following documents are effectively equivalent:
<P xmlns="http://www.w3.org/TR/Rec-html40"> This is a
<A href="foo.html">hyperlink</A>.</P>
<H:P xmlns:H="http://www.w3.org/TR/Rec-html40"> This is a
<A href="foo.html">hyperlink</A>.</H:P>
<H:P xmlns:H="http://www.w3.org/TR/Rec-html40"> This is a
<H:A href="foo.html">hyperlink</H:A>.</H:P>
but that:
<H:P xmlns:H="http://www.w3.org/TR/Rec-html40"> This is a
<H:A H:href="foo.html">hyperlink</H:A>.</H:P>
is different (because in 6.3 HREF and HTML:CLASS have different namespaces).
C: Software that provides specific processing for a namespace (e.g. MathML,
CML) has to have access to the ns as a hardcoded string. This is because
the namespaces extend beyond the document. Thus jumbo.cml.MoleculeNode may
need to search for elements in the document which have a universal name
containing ns="urn:www.xml-cml.org". Thus MoleculeNode might search its
children to see it there were any elements with universal name
"urn:www.xml-cml.org,ATOM". It has to distinguish this from ATOM provided
by another namespace - e.g. in computing.
D: FWIW I have been hacking namespaces into JUMBO2 and seem to require two
classes:
Namespace (one for each distinct xmlns in the document)
UniversalName (One for each distinct elementType and each distinct attribute)
If SAX can (a) process the minimisation completely and (b) return
Namespaces for the document and (c) return a universal name for each
Element and Attribute then I think I shall be very happy. From what various
people have said it seems fairly straightforward.
E: Authoring and transformation is more of a problem. I would suggest that
UniversalName carried its prefix in case the application wanted to re-emit
it. I suspect that any editing software would work with UniversalNames
(although the screen might display minimised names). This means that only
when the document comes to be written need one look to see if minimisation
and scoping was valuable.
Of course this might make some transformed documents more difficult for
humans to read - e.g. they might have no minimisation or it might be
applied completely throughout the document. But we have taken this view in
SAX - that comments are thrown away and that other minimisation details are
lost (e.g. whether an attribute was supplied in the document or the DTD).
So I think I can live with it.
P.
Peter Murray-Rust, Director Virtual School of Molecular Sciences, domestic
net connection
VSMS http://www.nottingham.ac.uk/vsms, Virtual Hyperglossary
http://www.venus.co.uk/vhg