Aleksander Slominski wrote:
i have code (PullParser2 and XPP3) that relies on start/endPrefixMapping and to be backward compatible i want to keep it.
however based on reading of release notes (http://xml.apache.org/xerces2-j/releases.html) i am not sure if in future those call may not be used (as they are now deprecated ...)
what is the best strategy to deal with it?
I had the same problem updating my NekoPull[1] API to be able to use all versions of Xerces2. In the end it didn't turn out to be that hard to fix. The hard part was handling changed method signatures -- needed Java reflection for that.
You can look at my code to see how I solved this problem. But here's the basic premise: there's a new startDocument method that passes the NamespaceContext object at the beginning of the document. Implement that method and keep a reference to the object. Then, in the start (and empty) element method callback(s), check for a non-null value for the namespace context. If it exists, then ask it for the count of declared prefixes, query the prefixes and URIs, and then call your existing start/endPrefixMapping methods. Does that make sense?
it is possible at all to have backward compatibility with older Xerces 2 (older versions of X2 are still used in many projects) or i should just give up on it and after checking X2 verion fail fast by throwing exception to user?
Please be aware that we are currently discussing changing the namespace context interface. (See the posts from Elena about this subject.) Now that we have learned more about using the new framework, we feel that certain API changes are required and this is one of the changes. So once we've concluded our discussions and made the changes, we plan on versioning the XNI frame- work. Then, subsequent changes will go into future versions of the API. [1] http://www.apache.org/~andyc/neko/doc/pull/index.html -- Andy Clark * [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
