Namespaces !

Peter Murray-Rust peter at ursus.demon.co.uk
Tue Aug 4 17:38:36 BST 1998


At 15:30 04/08/98 +0200, Ron Bourret wrote:
[...]
>This is not really different from the old spec, except for more
flexibility in 
>the scoping of namespace prefixes.  If you (as an instance author) want to 
>duplicate the old PI, just add your prefix attribute to the root element.
If 
>you want more limited scope, add it to the appropriate nested element.  The 
>other (minor) advantage of the new spec is that (depending on the parser
used 
>and where the DTD resides), the namespace prefix can be declared by in the
DTD, 
>which means that instance authors do not need to remember to include the PI.
>
[...]
>
>(Beware not to assume any magic about namespaces.  I used to imagine that
they 
>would automatically merge XML files and their corresponding DTDs.  While
it is 
>certainly possible to build the software to do this, using namespaces to
resolve 
>collisions, it is not (yet) a common operation.  Most people are going to
create 
>documents from fixed DTDs in which all namespace collisions have already
been 
>resolved by hand.)
>
I think Ron has described this very well. I sympathise very much with
people who have found the new spec comes as a shock. As JamesC has already
mentioned the XML-WG spent a lot of time addressing some of the questions
that many of you naturally want to ask. Although we are only at day+1 I
think the discussion so far has been very constructive and suggests we can
start discussing implementation.

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

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list