Revised namespaces draft available

John Cowan cowan at locke.ccil.org
Wed Aug 5 16:23:53 BST 1998


Peter Murray-Rust wrote:

> Since namespaces are so fundamental I think it's very important that we
> outline the various ways forward. AIUI your filter sits on top of SAX
> whereas I suspect others (including at least myself privately) want SAX to
> do as much as possible. We don't want these to be incompatible.

ParserFilters sit on top of SAX, but in a SAX-compliant way:
a ParserFilter is a (SAX) Parser.  This is deliberately analogous
to the way in which you can "push" modules onto a Java InputStream,
OutputStream, Reader, or Writer, and still have something that
conforms to that interface but can do new things as well.

So you instantiate your SAX parser of choice, instantiate
a NamespaceFilter, connect the two with a single call, and then
just use the NamespaceFilter as a Parser, because it is one.
The rest of your application doesn't change at all (except,
of course, that it gets QNames in universal format).

> This isn't much fun. It would be a very easy mistake to make. Can we
> package the NS stuff in a single file and do something like:
> 
> <!DOCTYPE ABC SYSTEM "abc.dtd" [
> <!ENTITY % namespace1 SYSTEM "namespace1.ent">
> %namespace1;
> <!ENTITY % namespace2 SYSTEM "namespace2.ent">
> %namespace2;
> ]>
> 
> This makes sure it gets included.

Alas, no.  Only if your parser is validating (and in SAX, there isn't
even a way to *ask* if a parser is validating) are you guaranteed to
process this.  A NVP is free to treat the above as a comment.

> >>                 - IBTWSH
> >
> >IBTWSH is non-namespace rather than single-namespace.
> 
>         My point was that if I use it in (say) VHG - as I intend to - it has to
> acquire a namespace. Thus:
> 
> <VHG:termEntry xmlns:VHG="urn:vhg.co.uk:schema"> <!-- please tell me if
> this is wrong -->
>   <VHG:term xml:lang="en" xmlns:xml="http://w3.org">XYZZY</VHG:term>
>   <VHG:definition>
>     <IB:P xmlns:IB="http://john.cowan.some.where">A magic word</IB:P>
>   </VHG:definition>
> </VHG:termEntry>
> 
> unless you intend that it should always have the null namespace xmlns="". I
> wouldn't think that a good idea.

I intend that IBTWSH always have the same ns as HTML, which is currently
the null namespace.  So above, make it:

	<P xmlns="">A magic word</P>

I am considering modifying the current IBTWSH DTD to define "xmlns" as
the null string in all elements.  This is not strictly HTML-compatible,
but people usually feel free to extend HTML with new attributes.

-- 
John Cowan	http://www.ccil.org/~cowan		cowan at ccil.org
	You tollerday donsk?  N.  You tolkatiff scowegian?  Nn.
	You spigotty anglease?  Nnn.  You phonio saxo?  Nnnn.
		Clear all so!  'Tis a Jute.... (Finnegans Wake 16.5)

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