[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: SAX Namespaces? ContentHandlers? Jobs.

  • From: David Megginson <david@m...>
  • To: XML-DEV <xml-dev@x...>
  • Date: 06 Apr 2000 09:47:53 -0400

re h1 jobs processing
"Ean R . Schuessler" <ean@n...> 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@m...

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


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.