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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: SAX2: Namespace Processing and NSUtils helper class

[ Lists Home | Date Index | Thread Index ]
  • From: "Clark C. Evans" <clark.evans@manhattanproject.com>
  • To: Ray Waldin <rwaldin@pacbell.net>
  • Date: Wed, 15 Dec 1999 16:07:52 -0500 (EST)


This is very interesting....

On Thu, 16 Dec 1999, Ray Waldin wrote:
> I'm only a user of SAX and not an implementor, but I've always 
> expected SAX 2 to include namespace scoping events.  It seems 
> a bit restrictive to completely hide these events from
> an application.  For example:
> 
> <element1 xmlns="uri1" xmlns:p2="uri2">
>   <ns2:element2 foo="bar" xmlns:p3="uri3" p3:whiz="bang"/>
> </element1>

I assume you mean "p2" instead of "ns2" ?

> would produce the following stream of events:
> 
>   startDocument();
>   startNamespace( prefix=null, uri="uri1" );
>   startNamespace( prefix="p2", uri="uri2" );
>   startElement( name="element1", attrList=null );
>   startNamespace( prefix="p3", uri="uri3" );
>   startElement( name="p2:element2", attrList={ foo="bar", p3:whiz="bang" });
>   endElement( name="p2:element2" )
>   endNamespace( prefix="p3" );
>   endElement( name="element1" );
>   endNamespace( prefix="p2" );
>   endNamespace( prefix="p1" );
>   endDocument();
> 

Slight problem.

The namespaces are defined *after* the element
tag begins.  So, startNamespace would logically
be *inside* of the element like:

startDocument()
  startElement(name="element1" attributes="{...}" )
    defineNamespace(prefix=null, uri="uri1");
     ...

However, attributes (since they are random
and not sequential access), occur within
the event scope of the element.  Yet, the
namespace applies to the attribute!

I realise you put the events immediately
preceding the begin tag and immediately 
following the end tag to get around this
problem, but it just doesn't look pretty.

However, your suggestion would work perfectly
for the 100% pure sequential access interface
which JClark has for native expat !

Best,

Clark 









xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)






 

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

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