[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Yet another SAX2 observation
Title: Yet another SAX2 observation In trying to properly implement the in-scope namespaces Infoset property, I found the following inconvenience with SAX2. The ordering of startPrefixMapping and startElement requires the implementation of ContentHandler to either (a) create a new "scoping context" for each namespace declaration or (b) keep a data member around to note that a new element has started. The current docs regarding calling NamespaceSupport.pushContext at every startElement notification doesn't work. Assume the following implementation of ContentHandler: class me implements DefaultHandler {
This implementation chokes, since the pushing needs to happen at the first startPrefixMapping, not at the startElement notification. Rather, to implement this correctly, one must write the code as follows: class me implements DefaultHandler {
I have a feeling this isn't what people had in mind. I actually think the flaw is in ContentHandler, since the current design requires the implementation to retain additional state in order to match up namespace declarations with the elements they correspond to. DB
|
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
|