OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: SAX Namespaces? ContentHandlers? Jobs.

[ Lists Home | Date Index | Thread Index ]
  • From: David Megginson <david@megginson.com>
  • To: XML-DEV <xml-dev@xml.org>
  • Date: 06 Apr 2000 09:47:53 -0400

"Ean R . Schuessler" <ean@novare.net> writes:

> - Since you map URIs (which are unique, hopefully) to prefixes
> (which may not be unique) what exactly do namespaces achieve? Is it
> useful since you then know explicitly that a collision exists?
> Wouldn't it be more reliable to just use long XML tag names like:
> org-webslinger-sax-flop?

No more reliable, I shouldn't think, but (a) more transparent [good]
and (b) more verbose [bad].  It was a judgement call, but I think that
most of us on the WG didn't think that something like this would ever


     <http..www.w3.org..1999..xhtml:p>Hello, and welcome to
        href="http://www.megginson.com/>Megginson Technolgoies</http..www.w3.org..1999..xhtml:a></http..www.w3.org..1999..xhtml:p>

while we thought that something like this would

  <html xmlns="http://www.w3.org/1999/xhtml">
    <p>Hello, and welcome to <a
      href="http://www.megginson.com/">Megginson Technologies.</a></p>

> - If you are writing a generic SAX filter that would be used by multiple
>   applications how should it handle namespaces? Like, if I write a SAX
>   Filter that converts <date/> into the current date and I want it to
>   just operate in the "foo" namespace, how is that done? Do I just make
>   up my own API conventions for it, like "new DateFilter( namespace )"?

The thing is, 'date' will mean something different in each Namespace,
so the filter should *only* operate on it in a specific Namespace.  If
you define an element {http://novare.net/ns/}date that means "whatever
the current date is at time of processing", then the DateFilter should 
look for 'date' only in that Namespace (no matter what the document

It's the same thing as Java packages -- you would write code that uses
org.foo.stuff.Thingy, but you would never assume that a class named
"Thingy" in any package (say, org.bar.hack.Thingy) is the same.

> So, thats one thing. Another thing that I'm confused about is how you
> communicate "out of band" or config data to a ContentHandler. XMLReader,
> obviously, has Features and Properities which are useful for telling it
> special things. How do you do similar things (querying capabilities,
> setting configuration data, etc.) on a Content Handler? Should it not be
> done? Should I make up my own API that will have to be replaced later?

In SAX, requests flow upstream and data flows downstream -- that's
just the way we designed it.  It keeps life very simple for
implementors of client software, but it means that filters have to
start with some kind of a reasonable default state and wait for an
explicit request to change it, rather than going out and actively
querying the client.  That's a pretty normal approach -- JDBC drivers, 
for example, don't go out and query the client application either.

All the best,


David Megginson                 david@megginson.com

This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS