|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: [Sax-devel] Is the SAX NamespaceSupport class broken?
Quoth: "Elliotte Rusty Harold" <elharo@m...> > I'd like to use an org.xml.sax.helpers.NamespaceSupport object to keep > track of the namesapces in scope at various points in my ContentHandler, > which is exactly what I think it's designed to do. Well, one of its tasks. It's described as "for use by SAX Drivers", but the same logic should be used in applications if they are willing to deal with the quirk you identified: > OK, simple enough. I need to start a new context for each element. Now I > need to add declarations to that context using the declarePrefix() > method. However, the information I need to track the declared prefixes > are provided by the startPrefixMapping() method, which is called > *before* the corresponding startElement() method is called. I call this a doc bug. The "you" in the documentation is a parser writer, for whom it makes a certain degree of sense: they'll pushContext() THEN make the startPrefixMapping() callbacks for xmlns* attributes, then make the second pass over element/attribute names to get the URIs and localnames, and then finally call startElement(). When the "you" is an application, it's different. Creating the context must be done at either of two locations: startElement(), or else the first startPrefixMapping(). As David Megginson wrote, the fix is a single flag. In fact I did a writeup on NamespaceSupport recently (for a certain SAX2 book :) where I said exactly that. I'll provide a fix in the javadoc, and push it out soon after SourceForge starts talking to me again. (The SSH services seem to be AWOL this weekend.) - Dave
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








